import pprint

n = int(eval(input()))

dp = [{} for i in range(n + 1)]

s = "AGCT"

M = 10 ** 9 + 7



for j in range(n + 1):

  for c1 in s:

    for c2 in s:

      for c3 in s:

        dp[j][c1 + c2 + c3] = 0



dp[0]["TTT"] = 1



for l in range(n):

  for c1 in s:

    for c2 in s:

      for c3 in s:

        for p in s:

          if c2 == "A" and c3 == "G" and p == "C":

            continue

          if c1 == "A" and c3 == "G" and p == "C":

            continue

          if c1 == "A" and c2 == "G" and p == "C":

            continue

          if c2 == "G" and c3 == "A" and p == "C":

            continue

          if c2 == "A" and c3 == "C" and p == "G":

            continue

          dp[l + 1][c2 + c3 + p] += dp[l][c1 + c2 + c3]

          dp[l + 1][c2 + c3 + p] = dp[l + 1][c2 + c3 + p] % M



ans = 0

for c1 in s:

  for c2 in s:

    for c3 in s:

      ans += dp[n][c1 + c2 + c3]

      ans = ans % M

print(ans)

import pprint

n = int(eval(input()))

dp = [{} for i in range(n + 1)]

s = "AGCT"

M = 10 ** 9 + 7



for j in range(n + 1):

  for c1 in s:

    for c2 in s:

      for c3 in s:

        dp[j][c1 + c2 + c3] = 0



dp[0]["TTT"] = 1



for l in range(n):

  for c1 in s:

    for c2 in s:

      for c3 in s:

        for p in s:

          if c2 == "A" and c3 == "G" and p == "C":

            continue

          if c1 == "A" and c3 == "G" and p == "C":

            continue

          if c1 == "A" and c2 == "G" and p == "C":

            continue

          if c2 == "G" and c3 == "A" and p == "C":

            continue

          if c2 == "A" and c3 == "C" and p == "G":

            continue

          dp[l + 1][c2 + c3 + p] = (dp[l + 1][c2 + c3 + p] + dp[l][c1 + c2 + c3]) % M

          



ans = 0

for c1 in s:

  for c2 in s:

    for c3 in s:

      ans += dp[n][c1 + c2 + c3]

      ans = ans % M

print(ans)

import pprint

n = int(eval(input()))
dp = [{} for i in range(n + 1)]
s = "AGCT"
M = 10**9 + 7
for j in range(n + 1):
    for c1 in s:
        for c2 in s:
            for c3 in s:
                dp[j][c1 + c2 + c3] = 0
dp[0]["TTT"] = 1
for l in range(n):
    for c1 in s:
        for c2 in s:
            for c3 in s:
                for p in s:
                    if c2 == "A" and c3 == "G" and p == "C":
                        continue
                    if c1 == "A" and c3 == "G" and p == "C":
                        continue
                    if c1 == "A" and c2 == "G" and p == "C":
                        continue
                    if c2 == "G" and c3 == "A" and p == "C":
                        continue
                    if c2 == "A" and c3 == "C" and p == "G":
                        continue
                    dp[l + 1][c2 + c3 + p] += dp[l][c1 + c2 + c3]
                    dp[l + 1][c2 + c3 + p] = dp[l + 1][c2 + c3 + p] % M
ans = 0
for c1 in s:
    for c2 in s:
        for c3 in s:
            ans += dp[n][c1 + c2 + c3]
            ans = ans % M
print(ans)

import pprint

n = int(eval(input()))
dp = [{} for i in range(n + 1)]
s = "AGCT"
M = 10**9 + 7
for j in range(n + 1):
    for c1 in s:
        for c2 in s:
            for c3 in s:
                dp[j][c1 + c2 + c3] = 0
dp[0]["TTT"] = 1
for l in range(n):
    for c1 in s:
        for c2 in s:
            for c3 in s:
                for p in s:
                    if c2 == "A" and c3 == "G" and p == "C":
                        continue
                    if c1 == "A" and c3 == "G" and p == "C":
                        continue
                    if c1 == "A" and c2 == "G" and p == "C":
                        continue
                    if c2 == "G" and c3 == "A" and p == "C":
                        continue
                    if c2 == "A" and c3 == "C" and p == "G":
                        continue
                    dp[l + 1][c2 + c3 + p] = (
                        dp[l + 1][c2 + c3 + p] + dp[l][c1 + c2 + c3]
                    ) % M
ans = 0
for c1 in s:
    for c2 in s:
        for c3 in s:
            ans += dp[n][c1 + c2 + c3]
            ans = ans % M
print(ans)

-                    dp[l + 1][c2 + c3 + p] += dp[l][c1 + c2 + c3] -                    dp[l + 1][c2 + c3 + p] = dp[l + 1][c2 + c3 + p] % M +                    dp[l + 1][c2 + c3 + p] = ( +                        dp[l + 1][c2 + c3 + p] + dp[l][c1 + c2 + c3] +                    ) % M