N = int(eval(input()))



dp = [[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N+1)]



dp[0][0][0][0] = 1



# Aを1、Gを2、Cを3、Tを4とする

# k は３つ前、jは２つ前、iは１つ前の情報

for n in range(N):

    for i in range(5):

        for j in range(5):

            for k in range(5):

                # tは今の情報

                for t in range(1, 5):

                    #AGC

                    if i == 2 and j == 1 and t == 3:

                        continue

                    #ACG

                    if i == 3 and j == 1 and t == 2:

                        continue

                    #GAC

                    if i == 1 and j == 2 and t == 3:

                        continue

                    #A?GC

                    if i == 2 and k == 1 and t == 3:

                        continue

                    #AG?C

                    if j == 2 and k == 1 and t == 3:

                        continue

                        

                    dp[n+1][t][i][j] += dp[n][i][j][k]



sums = 0

for i in range(1, 5):

    for j in range(1, 5):

        for k in range(1, 5):

            sums += dp[N][i][j][k]



print((sums % (10**9 + 7)))

N = int(eval(input()))



dp = [[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N+1)]



dp[0][0][0][0] = 1



# Aを1、Gを2、Cを3、Tを4とする

# j は３つ前、kは２つ前、lは１つ前の情報

for i in range(N):

    for j in range(5):

        for k in range(5):

            for l in range(5):

                # tは今の情報

                for t in range(1, 5):

                    if k == 1 and l == 2 and t == 3:

                        continue

                    if k == 2 and l == 1 and t == 3:

                        continue

                    if k == 1 and l == 3 and t == 2:

                        continue

                    if j == 1 and l == 2 and t == 3:

                        continue

                    if j == 1 and k == 2 and t == 3:

                        continue

                    dp[i+1][t][l][k] += dp[i][l][k][j]



sums = 0

for j in range(1, 5):

    for k in range(1, 5):

        for l in range(1, 5):

            sums += dp[N][l][k][j]



print((sums % (10**9 + 7)))

N = int(eval(input()))
dp = [
    [[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N + 1)
]
dp[0][0][0][0] = 1
# Aを1、Gを2、Cを3、Tを4とする
# k は３つ前、jは２つ前、iは１つ前の情報
for n in range(N):
    for i in range(5):
        for j in range(5):
            for k in range(5):
                # tは今の情報
                for t in range(1, 5):
                    # AGC
                    if i == 2 and j == 1 and t == 3:
                        continue
                    # ACG
                    if i == 3 and j == 1 and t == 2:
                        continue
                    # GAC
                    if i == 1 and j == 2 and t == 3:
                        continue
                    # A?GC
                    if i == 2 and k == 1 and t == 3:
                        continue
                    # AG?C
                    if j == 2 and k == 1 and t == 3:
                        continue
                    dp[n + 1][t][i][j] += dp[n][i][j][k]
sums = 0
for i in range(1, 5):
    for j in range(1, 5):
        for k in range(1, 5):
            sums += dp[N][i][j][k]
print((sums % (10**9 + 7)))

N = int(eval(input()))
dp = [
    [[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N + 1)
]
dp[0][0][0][0] = 1
# Aを1、Gを2、Cを3、Tを4とする
# j は３つ前、kは２つ前、lは１つ前の情報
for i in range(N):
    for j in range(5):
        for k in range(5):
            for l in range(5):
                # tは今の情報
                for t in range(1, 5):
                    if k == 1 and l == 2 and t == 3:
                        continue
                    if k == 2 and l == 1 and t == 3:
                        continue
                    if k == 1 and l == 3 and t == 2:
                        continue
                    if j == 1 and l == 2 and t == 3:
                        continue
                    if j == 1 and k == 2 and t == 3:
                        continue
                    dp[i + 1][t][l][k] += dp[i][l][k][j]
sums = 0
for j in range(1, 5):
    for k in range(1, 5):
        for l in range(1, 5):
            sums += dp[N][l][k][j]
print((sums % (10**9 + 7)))

-# k は３つ前、jは２つ前、iは１つ前の情報 -for n in range(N): -    for i in range(5): -        for j in range(5): -            for k in range(5): +# j は３つ前、kは２つ前、lは１つ前の情報 +for i in range(N): +    for j in range(5): +        for k in range(5): +            for l in range(5): -                    # AGC -                    if i == 2 and j == 1 and t == 3: +                    if k == 1 and l == 2 and t == 3: -                    # ACG -                    if i == 3 and j == 1 and t == 2: +                    if k == 2 and l == 1 and t == 3: -                    # GAC -                    if i == 1 and j == 2 and t == 3: +                    if k == 1 and l == 3 and t == 2: -                    # A?GC -                    if i == 2 and k == 1 and t == 3: +                    if j == 1 and l == 2 and t == 3: -                    # AG?C -                    if j == 2 and k == 1 and t == 3: +                    if j == 1 and k == 2 and t == 3: -                    dp[n + 1][t][i][j] += dp[n][i][j][k] +                    dp[i + 1][t][l][k] += dp[i][l][k][j] -for i in range(1, 5): -    for j in range(1, 5): -        for k in range(1, 5): -            sums += dp[N][i][j][k] +for j in range(1, 5): +    for k in range(1, 5): +        for l in range(1, 5): +            sums += dp[N][l][k][j]