n = int(eval(input()))

dp = [[0]*4 for i in range(n+1)]

mod = 10**9+7



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

dp[1][0] = dp[1][1] = dp[1][2] = dp[1][3] = 4



for i in range(2,n):

    for j in range(4):

        dp[i][j] = sum(dp[i-1])%mod

    dp[i][1] -= dp[i-2][0]

    dp[i][2] -= (dp[i-2][0] + dp[i-2][1])

    if i >= 3:

        dp[i][2] -= 3*dp[i-3][0]

        dp[i][1] += dp[i-3][1]

        



print((sum(dp[n-1])%mod))
n = int(eval(input()))



mod = 10**9 + 7



a = [0]*n

c = [0]*n

g = [0]*n

t = [0]*n



a[0] = c[0] = g[0] = t[0] = 1

a[1] = c[1] = g[1] = t[1] = 4

a[2], c[2], g[2], t[2] = 16, 14, 15, 16



for i in range(3, n):

    v = (a[i-1] + c[i-1] + g[i-1] + t[i-1]) % mod

    a[i] = v

    c[i] = (v - a[i-2] - g[i-2] - 3*a[i-3]) % mod

    g[i] = (v - a[i-2] + g[i-3]) % mod

    t[i] = v

print(((a[n-1] + c[n-1] + g[n-1] + t[n-1]) % mod))
n = int(eval(input()))
dp = [[0] * 4 for i in range(n + 1)]
mod = 10**9 + 7
dp[0][0] = dp[0][1] = dp[0][2] = dp[0][3] = 1
dp[1][0] = dp[1][1] = dp[1][2] = dp[1][3] = 4
for i in range(2, n):
    for j in range(4):
        dp[i][j] = sum(dp[i - 1]) % mod
    dp[i][1] -= dp[i - 2][0]
    dp[i][2] -= dp[i - 2][0] + dp[i - 2][1]
    if i >= 3:
        dp[i][2] -= 3 * dp[i - 3][0]
        dp[i][1] += dp[i - 3][1]
print((sum(dp[n - 1]) % mod))

n = int(eval(input()))
mod = 10**9 + 7
a = [0] * n
c = [0] * n
g = [0] * n
t = [0] * n
a[0] = c[0] = g[0] = t[0] = 1
a[1] = c[1] = g[1] = t[1] = 4
a[2], c[2], g[2], t[2] = 16, 14, 15, 16
for i in range(3, n):
    v = (a[i - 1] + c[i - 1] + g[i - 1] + t[i - 1]) % mod
    a[i] = v
    c[i] = (v - a[i - 2] - g[i - 2] - 3 * a[i - 3]) % mod
    g[i] = (v - a[i - 2] + g[i - 3]) % mod
    t[i] = v
print(((a[n - 1] + c[n - 1] + g[n - 1] + t[n - 1]) % mod))

-dp = [[0] * 4 for i in range(n + 1)] -dp[0][0] = dp[0][1] = dp[0][2] = dp[0][3] = 1 -dp[1][0] = dp[1][1] = dp[1][2] = dp[1][3] = 4 -for i in range(2, n): -    for j in range(4): -        dp[i][j] = sum(dp[i - 1]) % mod -    dp[i][1] -= dp[i - 2][0] -    dp[i][2] -= dp[i - 2][0] + dp[i - 2][1] -    if i >= 3: -        dp[i][2] -= 3 * dp[i - 3][0] -        dp[i][1] += dp[i - 3][1] -print((sum(dp[n - 1]) % mod)) +a = [0] * n +c = [0] * n +g = [0] * n +t = [0] * n +a[0] = c[0] = g[0] = t[0] = 1 +a[1] = c[1] = g[1] = t[1] = 4 +a[2], c[2], g[2], t[2] = 16, 14, 15, 16 +for i in range(3, n): +    v = (a[i - 1] + c[i - 1] + g[i - 1] + t[i - 1]) % mod +    a[i] = v +    c[i] = (v - a[i - 2] - g[i - 2] - 3 * a[i - 3]) % mod +    g[i] = (v - a[i - 2] + g[i - 3]) % mod +    t[i] = v +print(((a[n - 1] + c[n - 1] + g[n - 1] + t[n - 1]) % mod))