#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int N,MOD=pow(10,9)+7;
map<ll,map<string,ll> > memo;

bool ok(string last4){
    REP(i,4){
        string str=last4;
        if(i>=1){
            swap(str[i],str[i-1]);
        }
        if(str.find("AGC") != -1){
            return false;
        }
    }
    return true;
}

ll dfs(int cur, string last3){
    if(memo[cur][last3] != 0)return memo[cur][last3];
    if(cur == N)return 1;
    ll res=0;
    char agct[4]={'A','G','C','T'};
    REP(i,4){
        if(ok(last3+agct[i])){
            string next=last3.substr(1,2)+agct[i];
            res=res+dfs(cur+1,next)%MOD;
        }
    }
    memo[cur][last3]=res;
    return res;
}

int main(){
    cin >> N;
    dfs(0,"TTT");
    cout << memo[0]["TTT"]%MOD;
    return 0;   
}
### Prompt

Your task is to create a cpp solution to the following problem:

You are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:

* The string does not contain characters other than `A`, `C`, `G` and `T`.
* The string does not contain `AGC` as a substring.
* The condition above cannot be violated by swapping two adjacent characters once.

Constraints

* 3 \leq N \leq 100

Input

Input is given from Standard Input in the following format:


N


Output

Print the number of strings of length N that satisfy the following conditions, modulo 10^9+7.

Examples

Input

3


Output

61


Input

4


Output

230


Input

100


Output

388130742

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;

int N,MOD=pow(10,9)+7;
map<ll,map<string,ll> > memo;

bool ok(string last4){
    REP(i,4){
        string str=last4;
        if(i>=1){
            swap(str[i],str[i-1]);
        }
        if(str.find("AGC") != -1){
            return false;
        }
    }
    return true;
}

ll dfs(int cur, string last3){
    if(memo[cur][last3] != 0)return memo[cur][last3];
    if(cur == N)return 1;
    ll res=0;
    char agct[4]={'A','G','C','T'};
    REP(i,4){
        if(ok(last3+agct[i])){
            string next=last3.substr(1,2)+agct[i];
            res=res+dfs(cur+1,next)%MOD;
        }
    }
    memo[cur][last3]=res;
    return res;
}

int main(){
    cin >> N;
    dfs(0,"TTT");
    cout << memo[0]["TTT"]%MOD;
    return 0;   
}
```