import re,functools as f;d=f.lru_cache(999)(lambda n,b:n<1or sum(d(n-1,b[1:]+s)for s in'ACGT'if not re.match('.AGC|.ACG|.GAC|A.GC|AG.C',b+s))%(10**9+7));print((d(int(eval(input())),'TTT')))
a=b=c=d=e=f=0;g=1;exec('a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3)%(10**9+7);'*int(eval(input())));print(g)
import re, functools as f

d = f.lru_cache(999)(
    lambda n, b: n < 1
    or sum(
        d(n - 1, b[1:] + s)
        for s in "ACGT"
        if not re.match(".AGC|.ACG|.GAC|A.GC|AG.C", b + s)
    )
    % (10**9 + 7)
)
print((d(int(eval(input())), "TTT")))

a = b = c = d = e = f = 0
g = 1
exec("a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3)%(10**9+7);" * int(eval(input())))
print(g)

-import re, functools as f - -d = f.lru_cache(999)( -    lambda n, b: n < 1 -    or sum( -        d(n - 1, b[1:] + s) -        for s in "ACGT" -        if not re.match(".AGC|.ACG|.GAC|A.GC|AG.C", b + s) -    ) -    % (10**9 + 7) -) -print((d(int(eval(input())), "TTT"))) +a = b = c = d = e = f = 0 +g = 1 +exec("a,b,c,d,e,f,g=b,e,e-d,f,g,g-c,(g*4-b-c-d-a*3)%(10**9+7);" * int(eval(input()))) +print(g)