N, MOD = int(eval(input())), 10 ** 9 + 7

memo = [{} for i in range(N+1)]



def ok(last4):

	for i in range(4):

		t = list(last4)

		if i >= 1:

			t[i-1], t[i] = t[i], t[i-1]

		if ''.join(t).count('AGC') >= 1:

			return False

	return True



def dfs(cur, last3):

	if last3 in memo[cur]:

		return memo[cur][last3]

	if cur == N:

		return 1

	ret = 0

	for c in 'ACGT':

		if ok(last3 + c):

			ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD

	memo[cur][last3] = ret

	return ret



print((dfs(0, 'TTT')))
N, MOD = int(eval(input())), 10 ** 9 + 7

dp = [[[[0 for k in range(4)] for k in range(4)] for j in range(4)] for i in range(101)]

dp[0][3][3][3] = 1



for length in range(N):

  for i in range(4):

    for j in range(4):

      for k in range(4):

        if dp[length][i][j][k] == 0: continue

        for a in range(4):

          if a == 2 and i == 1 and j == 0: continue

          if a == 2 and i == 0 and j == 1: continue

          if a == 1 and i == 2 and j == 0: continue

          if a == 2 and i == 1 and k == 0: continue

          if a == 2 and j == 1 and k == 0: continue



          dp[length + 1][a][i][j] += dp[length][i][j][k]

          dp[length + 1][a][i][j] %= MOD



ans = 0

for i in range(4):

  for j in range(4):

    for k in range(4):

      ans += dp[N][i][j][k]

      ans %= MOD



print(ans)

N, MOD = int(eval(input())), 10**9 + 7
memo = [{} for i in range(N + 1)]


def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if "".join(t).count("AGC") >= 1:
            return False
    return True


def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in "ACGT":
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret


print((dfs(0, "TTT")))

N, MOD = int(eval(input())), 10**9 + 7
dp = [[[[0 for k in range(4)] for k in range(4)] for j in range(4)] for i in range(101)]
dp[0][3][3][3] = 1
for length in range(N):
    for i in range(4):
        for j in range(4):
            for k in range(4):
                if dp[length][i][j][k] == 0:
                    continue
                for a in range(4):
                    if a == 2 and i == 1 and j == 0:
                        continue
                    if a == 2 and i == 0 and j == 1:
                        continue
                    if a == 1 and i == 2 and j == 0:
                        continue
                    if a == 2 and i == 1 and k == 0:
                        continue
                    if a == 2 and j == 1 and k == 0:
                        continue
                    dp[length + 1][a][i][j] += dp[length][i][j][k]
                    dp[length + 1][a][i][j] %= MOD
ans = 0
for i in range(4):
    for j in range(4):
        for k in range(4):
            ans += dp[N][i][j][k]
            ans %= MOD
print(ans)

-memo = [{} for i in range(N + 1)] - - -def ok(last4): +dp = [[[[0 for k in range(4)] for k in range(4)] for j in range(4)] for i in range(101)] +dp[0][3][3][3] = 1 +for length in range(N): -        t = list(last4) -        if i >= 1: -            t[i - 1], t[i] = t[i], t[i - 1] -        if "".join(t).count("AGC") >= 1: -            return False -    return True - - -def dfs(cur, last3): -    if last3 in memo[cur]: -        return memo[cur][last3] -    if cur == N: -        return 1 -    ret = 0 -    for c in "ACGT": -        if ok(last3 + c): -            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD -    memo[cur][last3] = ret -    return ret - - -print((dfs(0, "TTT"))) +        for j in range(4): +            for k in range(4): +                if dp[length][i][j][k] == 0: +                    continue +                for a in range(4): +                    if a == 2 and i == 1 and j == 0: +                        continue +                    if a == 2 and i == 0 and j == 1: +                        continue +                    if a == 1 and i == 2 and j == 0: +                        continue +                    if a == 2 and i == 1 and k == 0: +                        continue +                    if a == 2 and j == 1 and k == 0: +                        continue +                    dp[length + 1][a][i][j] += dp[length][i][j][k] +                    dp[length + 1][a][i][j] %= MOD +ans = 0 +for i in range(4): +    for j in range(4): +        for k in range(4): +            ans += dp[N][i][j][k] +            ans %= MOD +print(ans)