#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll n, d[105][500];
ll f(ll p, ll q) {
	ll i, z, s = 0;
	if (d[p][q] != -1) return d[p][q];
	if (p == n) return 1;
	for (i = 1; i <= 4; i++) {
		z = (q % 100) * 10 + i;
		if (z == 123 || z == 132 || z == 213) continue;
		if ((q / 100) == 1 && (q % 10) == 2 && i == 3) continue;
		if ((q / 10) == 12 && i == 3) continue;
		s = (s + f(p + 1, z)) % M;
	}
	return d[p][q] = s;
}
int main()
{
	cin >> n;
	memset(d, -1, sizeof(d));
	cout << f(0, 0);
    return 0;
}

### 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>
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll n, d[105][500];
ll f(ll p, ll q) {
	ll i, z, s = 0;
	if (d[p][q] != -1) return d[p][q];
	if (p == n) return 1;
	for (i = 1; i <= 4; i++) {
		z = (q % 100) * 10 + i;
		if (z == 123 || z == 132 || z == 213) continue;
		if ((q / 100) == 1 && (q % 10) == 2 && i == 3) continue;
		if ((q / 10) == 12 && i == 3) continue;
		s = (s + f(p + 1, z)) % M;
	}
	return d[p][q] = s;
}
int main()
{
	cin >> n;
	memset(d, -1, sizeof(d));
	cout << f(0, 0);
    return 0;
}

```