#include <bits/stdc++.h>
using namespace std;

const int maxn = 105;
const int mod = 1e9 + 7;

int n;
int dp[maxn][5][5][5][5]; // a - 0, c - 1, g - 2, t - 3

int rec (int pos, int l1, int l2, int l3, int l4) {
    if (dp[pos][l1][l2][l3][l4] != -1)
        return dp[pos][l1][l2][l3][l4];
    else if (l1 == 0 && l2 == 1 && l4 == 2)
        return 0;
    else if (l2 == 0 && l3 == 1 && l4 == 2)
        return 0;
    else if (l1 == 0 && l3 == 1 && l4 == 2)
        return 0;
    else if (l2 == 0 && l3 == 2 && l4 == 1)
        return 0;
    else if (l2 == 1 && l3 == 0 && l4 == 2)
        return 0;
    else if (pos == n)
        return 1;
    else {
        int res = 0;
        for (int i = 0; i < 4; ++i)
            (res += rec(pos + 1, l2, l3, l4, i)) %= mod;
        return dp[pos][l1][l2][l3][l4] = res;
    }
}

signed main () {
    cin >> n;
    memset(dp, -1, sizeof(dp));
    cout << rec(0, 4, 4, 4, 4) << '\n';
}

### Prompt

Develop a solution in CPP to the problem described below:

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;

const int maxn = 105;
const int mod = 1e9 + 7;

int n;
int dp[maxn][5][5][5][5]; // a - 0, c - 1, g - 2, t - 3

int rec (int pos, int l1, int l2, int l3, int l4) {
    if (dp[pos][l1][l2][l3][l4] != -1)
        return dp[pos][l1][l2][l3][l4];
    else if (l1 == 0 && l2 == 1 && l4 == 2)
        return 0;
    else if (l2 == 0 && l3 == 1 && l4 == 2)
        return 0;
    else if (l1 == 0 && l3 == 1 && l4 == 2)
        return 0;
    else if (l2 == 0 && l3 == 2 && l4 == 1)
        return 0;
    else if (l2 == 1 && l3 == 0 && l4 == 2)
        return 0;
    else if (pos == n)
        return 1;
    else {
        int res = 0;
        for (int i = 0; i < 4; ++i)
            (res += rec(pos + 1, l2, l3, l4, i)) %= mod;
        return dp[pos][l1][l2][l3][l4] = res;
    }
}

signed main () {
    cin >> n;
    memset(dp, -1, sizeof(dp));
    cout << rec(0, 4, 4, 4, 4) << '\n';
}

```