#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int N, memo[105][6][6][6];

int func(int idx, int before, int bbfore, int bbbfore)
{
    if(idx == N)
    {
        return 1;
    }
    int &ret = memo[idx][before][bbfore][bbbfore];
    if(ret != -1)
    {
        return ret;
    }
    ret = 0;
    for(int i = 1; i <= 4; i++)
    {
        if(i == 2 && ((before == 1 && bbfore == 3) || (before == 3 && bbfore == 1)))
        {
            continue;
        }
        if(i == 3 && before == 2 && bbfore == 1)
        {
            continue;
        }
        if(i == 2 && ((before == 3 && bbbfore == 1) || (bbfore == 3 && bbbfore == 1)))
        {
            continue;
        }
        ret = (ret + func(idx + 1, i, before, bbfore)) % 1000000007;
    }
    return ret;
}

int main()
{
    scanf("%d", &N);
    memset(memo, -1, sizeof memo);
    printf("%d\n", func(0, 0, 0, 0));
}
### Prompt

Generate 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 <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int N, memo[105][6][6][6];

int func(int idx, int before, int bbfore, int bbbfore)
{
    if(idx == N)
    {
        return 1;
    }
    int &ret = memo[idx][before][bbfore][bbbfore];
    if(ret != -1)
    {
        return ret;
    }
    ret = 0;
    for(int i = 1; i <= 4; i++)
    {
        if(i == 2 && ((before == 1 && bbfore == 3) || (before == 3 && bbfore == 1)))
        {
            continue;
        }
        if(i == 3 && before == 2 && bbfore == 1)
        {
            continue;
        }
        if(i == 2 && ((before == 3 && bbbfore == 1) || (bbfore == 3 && bbbfore == 1)))
        {
            continue;
        }
        ret = (ret + func(idx + 1, i, before, bbfore)) % 1000000007;
    }
    return ret;
}

int main()
{
    scanf("%d", &N);
    memset(memo, -1, sizeof memo);
    printf("%d\n", func(0, 0, 0, 0));
}
```