Mod = 10**9+7

p = ["XAGC", "XGAC", "XACG"] + ["AGCX", "GACX", "ACGX"] + ["AGXC", "AXGC"]

q = ["A", "G", "C", "T"]

f = []

for s in p:

  for c in q:

    f.append(s.replace("X",c))



r = ["AGC", "GAC", "ACG"]



d = {}

e = {}

for x in q:

  for y in q:

    for z in q:

      s = x+y+z

      if not s in r:

        d[s] = 1

        e[s] = 0

      

n = int(eval(input()))

for i in range(n-3):

  for s in list(e.keys()):

    for c in q:

      t = s+c

      if t in f:

        continue

      e[t[1:]] = (e[t[1:]]+d[s])%Mod

  for s in list(e.keys()):

    d[s] = e[s]

    e[s] = 0

    

print((sum(d.values())%Mod))
Mod = 10**9+7

f3 = ["AGC", "GAC", "ACG"]

f4 = ["AGAC","AGGC","AGCC","AGTC"] + ["AAGC","AGGC","ACGC","ATGC"]

q = ["A", "G", "C", "T"]



d = {}

e = {}

for x in q:

  for y in q:

    for z in q:

      s = x+y+z

      if not s in f3:

        d[s] = 1

        e[s] = 0

      

n = int(eval(input()))

for i in range(n-3):

  for s in list(e.keys()):

    for c in q:

      t = s+c

      if t[1:] in f3 or t in f4:

        continue

      e[t[1:]] = (e[t[1:]]+d[s])%Mod

  for s in list(e.keys()):

    d[s] = e[s]

    e[s] = 0

    

print((sum(d.values())%Mod))

Mod = 10**9 + 7
p = ["XAGC", "XGAC", "XACG"] + ["AGCX", "GACX", "ACGX"] + ["AGXC", "AXGC"]
q = ["A", "G", "C", "T"]
f = []
for s in p:
    for c in q:
        f.append(s.replace("X", c))
r = ["AGC", "GAC", "ACG"]
d = {}
e = {}
for x in q:
    for y in q:
        for z in q:
            s = x + y + z
            if not s in r:
                d[s] = 1
                e[s] = 0
n = int(eval(input()))
for i in range(n - 3):
    for s in list(e.keys()):
        for c in q:
            t = s + c
            if t in f:
                continue
            e[t[1:]] = (e[t[1:]] + d[s]) % Mod
    for s in list(e.keys()):
        d[s] = e[s]
        e[s] = 0
print((sum(d.values()) % Mod))

Mod = 10**9 + 7
f3 = ["AGC", "GAC", "ACG"]
f4 = ["AGAC", "AGGC", "AGCC", "AGTC"] + ["AAGC", "AGGC", "ACGC", "ATGC"]
q = ["A", "G", "C", "T"]
d = {}
e = {}
for x in q:
    for y in q:
        for z in q:
            s = x + y + z
            if not s in f3:
                d[s] = 1
                e[s] = 0
n = int(eval(input()))
for i in range(n - 3):
    for s in list(e.keys()):
        for c in q:
            t = s + c
            if t[1:] in f3 or t in f4:
                continue
            e[t[1:]] = (e[t[1:]] + d[s]) % Mod
    for s in list(e.keys()):
        d[s] = e[s]
        e[s] = 0
print((sum(d.values()) % Mod))

-p = ["XAGC", "XGAC", "XACG"] + ["AGCX", "GACX", "ACGX"] + ["AGXC", "AXGC"] +f3 = ["AGC", "GAC", "ACG"] +f4 = ["AGAC", "AGGC", "AGCC", "AGTC"] + ["AAGC", "AGGC", "ACGC", "ATGC"] -f = [] -for s in p: -    for c in q: -        f.append(s.replace("X", c)) -r = ["AGC", "GAC", "ACG"] -            if not s in r: +            if not s in f3: -            if t in f: +            if t[1:] in f3 or t in f4: