#x=int(input())

n=int(eval(input()))

m=102

chars=['A','T','C','G']

mo=10**9+7

d3=set()

d4=set()

for i in chars:

    for j in chars:

        for k in chars:

            d3.add(i+j+k)

            for l in chars:

                d4.add(i+j+k+l)

        

kinsoku4=set()

kinsoku3=['AGC','ACG','GAC']



for y in chars:

    kinsoku4.add('AG'+y+'C')

    kinsoku4.add('A'+y+'GC')

    for z in kinsoku3:

        kinsoku4.add(y+z)

        kinsoku4.add(z+y)





dp=[dict() for i in range(m)]

cnt=[0]*m

for i in d4:

    if i not in kinsoku4:

        dp[4][i]=1

    



t=101

for i in range(4,t):

    for ch in chars:

        for p in list(dp[i-1].keys()):

            if p[1:4]+ch not in kinsoku4:

                if p[1:4]+ch in dp[i]:

                    dp[i][p[1:4]+ch]+=dp[i-1][p]%mo

                else:

                    dp[i][p[1:4]+ch]=dp[i-1][p]%mo

for i in range(t):

    for x in d4:

        if x not in kinsoku4 and x in dp[i]:

            cnt[i]+=dp[i][x]%mo

    cnt[i]%=mo



#print(len(kinsoku4),kinsoku4)

#print(dp)



#for x in cnt:

    #print(x%mo)



if n==3:

    ans=61

    print(ans)

else:

    print((cnt[n]))





n=int(eval(input()))

m=102

chars=['A','T','C','G']

mo=10**9+7

d4=set()

for i in chars:

    for j in chars:

        for k in chars:

            for l in chars:

                d4.add(i+j+k+l)

        

kinsoku4=set()

kinsoku3=['AGC','ACG','GAC']



for y in chars:

    kinsoku4.add('AG'+y+'C')

    kinsoku4.add('A'+y+'GC')

    for z in kinsoku3:

        kinsoku4.add(y+z)

        kinsoku4.add(z+y)



dp=[dict() for i in range(m)]

cnt=[0]*m

for i in d4:

    if i not in kinsoku4:

        dp[4][i]=1



t=1+n

for i in range(4,t):

    for ch in chars:

        for p in list(dp[i-1].keys()):

            if p[1:4]+ch not in kinsoku4:

                if p[1:4]+ch in dp[i]:

                    dp[i][p[1:4]+ch]+=dp[i-1][p]%mo

                else:

                    dp[i][p[1:4]+ch]=dp[i-1][p]%mo

for i in range(t):

    for x in d4:

        if x not in kinsoku4 and x in dp[i]:

            cnt[i]+=dp[i][x]%mo

    cnt[i]%=mo



if n==3:

    ans=61

    print(ans)

else:

    print((cnt[n]))

# x=int(input())
n = int(eval(input()))
m = 102
chars = ["A", "T", "C", "G"]
mo = 10**9 + 7
d3 = set()
d4 = set()
for i in chars:
    for j in chars:
        for k in chars:
            d3.add(i + j + k)
            for l in chars:
                d4.add(i + j + k + l)
kinsoku4 = set()
kinsoku3 = ["AGC", "ACG", "GAC"]
for y in chars:
    kinsoku4.add("AG" + y + "C")
    kinsoku4.add("A" + y + "GC")
    for z in kinsoku3:
        kinsoku4.add(y + z)
        kinsoku4.add(z + y)
dp = [dict() for i in range(m)]
cnt = [0] * m
for i in d4:
    if i not in kinsoku4:
        dp[4][i] = 1
t = 101
for i in range(4, t):
    for ch in chars:
        for p in list(dp[i - 1].keys()):
            if p[1:4] + ch not in kinsoku4:
                if p[1:4] + ch in dp[i]:
                    dp[i][p[1:4] + ch] += dp[i - 1][p] % mo
                else:
                    dp[i][p[1:4] + ch] = dp[i - 1][p] % mo
for i in range(t):
    for x in d4:
        if x not in kinsoku4 and x in dp[i]:
            cnt[i] += dp[i][x] % mo
    cnt[i] %= mo
# print(len(kinsoku4),kinsoku4)
# print(dp)
# for x in cnt:
# print(x%mo)
if n == 3:
    ans = 61
    print(ans)
else:
    print((cnt[n]))

n = int(eval(input()))
m = 102
chars = ["A", "T", "C", "G"]
mo = 10**9 + 7
d4 = set()
for i in chars:
    for j in chars:
        for k in chars:
            for l in chars:
                d4.add(i + j + k + l)
kinsoku4 = set()
kinsoku3 = ["AGC", "ACG", "GAC"]
for y in chars:
    kinsoku4.add("AG" + y + "C")
    kinsoku4.add("A" + y + "GC")
    for z in kinsoku3:
        kinsoku4.add(y + z)
        kinsoku4.add(z + y)
dp = [dict() for i in range(m)]
cnt = [0] * m
for i in d4:
    if i not in kinsoku4:
        dp[4][i] = 1
t = 1 + n
for i in range(4, t):
    for ch in chars:
        for p in list(dp[i - 1].keys()):
            if p[1:4] + ch not in kinsoku4:
                if p[1:4] + ch in dp[i]:
                    dp[i][p[1:4] + ch] += dp[i - 1][p] % mo
                else:
                    dp[i][p[1:4] + ch] = dp[i - 1][p] % mo
for i in range(t):
    for x in d4:
        if x not in kinsoku4 and x in dp[i]:
            cnt[i] += dp[i][x] % mo
    cnt[i] %= mo
if n == 3:
    ans = 61
    print(ans)
else:
    print((cnt[n]))

-# x=int(input()) -d3 = set() -            d3.add(i + j + k) -t = 101 +t = 1 + n -# print(len(kinsoku4),kinsoku4) -# print(dp) -# for x in cnt: -# print(x%mo)