n = int(input())
MOD = 10 ** 9 + 7
# dp[i][i-1][i-2][i-3][i-4]
dp = [[[[[0] * (4) for _ in range(4)] for i in range(4)] for i in range(4)] for i in range(n + 1)]

to = {0:"A", 1:"C", 2:"G", 3:"T"}
for i1 in range(4):
    for i2 in range(4):
        for i3 in range(4):
            for i4 in range(4):
                if "AGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue
                if "ACG" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "GAC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "AAGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "ACGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "AGGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "ATGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "AGAC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "AGCC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "AGGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                if "AGTC" in to[i1] + to[i2] + to[i3] + to[i4]:
                    continue 
                dp[4][i1][i2][i3][i4] = 1

for i in range(4, n):
    for i1 in range(4):
        for i2 in range(4):
            for i3 in range(4):
                for i4 in range(4):
                    if "AGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue
                    if "ACG" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "GAC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "AAGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "ACGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "AGGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "ATGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "AGAC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "AGCC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "AGGC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    if "AGTC" in to[i1] + to[i2] + to[i3] + to[i4]:
                        continue 
                    for j in range(4):
                        dp[i + 1][i1][i2][i3][i4] += dp[i][i2][i3][i4][j]
                        dp[i + 1][i1][i2][i3][i4] %= MOD

if n == 3:
    print(61)
    exit()
ans = 0
for i1 in range(4):
    for i2 in range(4):
        for i3 in range(4):
            for i4 in range(4):
                ans += dp[-1][i1][i2][i3][i4]
                ans %= MOD
print(ans)

### FIXED CODE ###

n = int(input())
mod = 1000000007

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

# 0,1,2,3 ="AGCT"
for num in range(1):
  for c1 in range(4):
    for c2 in range(4):
      for c3 in range(4):
        for add in range(4):
          if c2 == 0 and c1 == 1 and add ==2:
            continue
          if c2 == 0 and c1 == 2 and add ==1:
            continue
          if c2 == 1 and c1 == 0 and add ==2:
            continue  
          if c3 == 0 and c2 == 1 and add ==2:
            continue
          if c3 == 0 and c1 == 1 and add ==2:
            continue
          dp[3][add][c1][c2] = 1

for num in range(1,n):
  for c1 in range(4):
    for c2 in range(4):
      for c3 in range(4):
        for add in range(4):
          if c2 == 0 and c1 == 1 and add ==2:
            continue
          if c2 == 0 and c1 == 2 and add ==1:
            continue
          if c2 == 1 and c1 == 0 and add ==2:
            continue  
          if c3 == 0 and c2 == 1 and add ==2:
            continue
          if c3 == 0 and c1 == 1 and add ==2:
            continue
          dp[num+1][add][c1][c2] += dp[num][c1][c2][c3]
          dp[num+1][add][c1][c2] %= mod

ans = 0

for c1 in range(4):
  for c2 in range(4):
    for c3 in range(4):
      ans += dp[n][c1][c2][c3]
      ans %= mod
if n ==1:
  print(4)
elif n ==2:
  print(16)
else:
  print(ans)