#include <iostream>
using namespace std;
typedef long long ll;
int n;
ll p=1e9+7, d[10000];
ll f(int x, int y, int z, int w){
    if(w==0)return 1;
    if(x!=-1&&d[(x*16+y*4+z)*100+w-1]>=0)return d[(x*16+y*4+z)*100+w-1];
    ll r=0;
    if(!(y==0&&z==2)&&!(x==0&&z==2)&&!(y==2&&z==0)&&!(x==0&&y==2)){
        r+=f(y, z, 1, w-1);
    }
    if(!(y==0&&z==1)){
        r+=f(y, z, 2, w-1);
    }
    r+=f(y, z, 0, w-1);
    r+=f(y, z, 3, w-1);
    r%=p;
    if(x!=-1){
        return d[(x*16+y*4+z)*100+w-1]=r;
    }
    return r;
}

int main(void){
    cin>>n;
    fill(d, d+10000, -1);
    ll ans=f(-1, -1, -1, n);
    cout<<ans<<endl;
}

### Prompt

Your challenge is to write 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 <iostream>
using namespace std;
typedef long long ll;
int n;
ll p=1e9+7, d[10000];
ll f(int x, int y, int z, int w){
    if(w==0)return 1;
    if(x!=-1&&d[(x*16+y*4+z)*100+w-1]>=0)return d[(x*16+y*4+z)*100+w-1];
    ll r=0;
    if(!(y==0&&z==2)&&!(x==0&&z==2)&&!(y==2&&z==0)&&!(x==0&&y==2)){
        r+=f(y, z, 1, w-1);
    }
    if(!(y==0&&z==1)){
        r+=f(y, z, 2, w-1);
    }
    r+=f(y, z, 0, w-1);
    r+=f(y, z, 3, w-1);
    r%=p;
    if(x!=-1){
        return d[(x*16+y*4+z)*100+w-1]=r;
    }
    return r;
}

int main(void){
    cin>>n;
    fill(d, d+10000, -1);
    ll ans=f(-1, -1, -1, n);
    cout<<ans<<endl;
}

```