n=int(eval(input()))

M,R=10**9+7,list(range(4))

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

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

for i in range(1,n+1):

  for j in R:

    for k in R:

      for l in R:

        for m in R:

          if(2,0,1)!=(k,l,m)!=(0,1,2)!=(k,l,m)!=(0,2,1)!=(j,l,m)!=(0,2,1)!=(j,k,m):dp[i][k][l][m]=(dp[i][k][l][m]+dp[i-1][j][k][l])%M

print((sum(c for a in dp[n]for b in a for c in b)%M))
n=int(eval(input()))

R=list(range(4))

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

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

for i in range(1,n+1):

  for j in R:

    for k in R:

      for l in R:

        for m in R:

          if(2,0,1)!=(k,l,m)!=(0,1,2)!=(k,l,m)!=(0,2,1)!=(j,l,m)!=(0,2,1)!=(j,k,m):dp[i][k][l][m]+=dp[i-1][j][k][l]

print((sum(c for a in dp[n]for b in a for c in b)%(10**9+7)))
n = int(eval(input()))
M, R = 10**9 + 7, list(range(4))
dp = [[[[0] * 4 for k in R] for j in R] for i in range(n + 1)]
dp[0][3][3][3] = 1
for i in range(1, n + 1):
    for j in R:
        for k in R:
            for l in R:
                for m in R:
                    if (
                        (2, 0, 1)
                        != (k, l, m)
                        != (0, 1, 2)
                        != (k, l, m)
                        != (0, 2, 1)
                        != (j, l, m)
                        != (0, 2, 1)
                        != (j, k, m)
                    ):
                        dp[i][k][l][m] = (dp[i][k][l][m] + dp[i - 1][j][k][l]) % M
print((sum(c for a in dp[n] for b in a for c in b) % M))

n = int(eval(input()))
R = list(range(4))
dp = [[[[0] * 4 for k in R] for j in R] for i in range(n + 1)]
dp[0][3][3][3] = 1
for i in range(1, n + 1):
    for j in R:
        for k in R:
            for l in R:
                for m in R:
                    if (
                        (2, 0, 1)
                        != (k, l, m)
                        != (0, 1, 2)
                        != (k, l, m)
                        != (0, 2, 1)
                        != (j, l, m)
                        != (0, 2, 1)
                        != (j, k, m)
                    ):
                        dp[i][k][l][m] += dp[i - 1][j][k][l]
print((sum(c for a in dp[n] for b in a for c in b) % (10**9 + 7)))

-M, R = 10**9 + 7, list(range(4)) +R = list(range(4)) -                        dp[i][k][l][m] = (dp[i][k][l][m] + dp[i - 1][j][k][l]) % M -print((sum(c for a in dp[n] for b in a for c in b) % M)) +                        dp[i][k][l][m] += dp[i - 1][j][k][l] +print((sum(c for a in dp[n] for b in a for c in b) % (10**9 + 7)))