import sys

sys.setrecursionlimit(10**7)

INF = 10 ** 18

MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF(): return [float(x) for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return input()



from itertools import product

import numpy as np



def main():

    N = II()

    A, G, C, T = 0, 1, 2, 3

    dp = np.zeros((N + 1, 4, 4, 4), int)

    dp[0, T, T, T] = 1

    for n in range(N):

        for p1, p2, p3 in product(range(4), repeat=3):

            for cur in range(4):

                if (p2, p1, cur) == (A, G, C):

                    continue

                if (p2, p1, cur) == (A, C, G):

                    continue

                if (p2, p1, cur) == (G, A, C):

                    continue

                if (p3, p1, cur) == (A, G, C):

                    continue

                if (p3, p2, cur) == (A, G, C):

                    continue

                dp[n + 1, cur, p1, p2] = \

                    (dp[n + 1, cur, p1, p2] + dp[n, p1, p2, p3]) % MOD

    ans = np.sum(dp[N])



    return ans % MOD



print(main())

import sys

sys.setrecursionlimit(10**7)

INF = 10 ** 18

MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF(): return [float(x) for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return eval(input())



from itertools import product



def main():

    N = II()

    A, G, C, T = list(range(4))

    def code(c0, c1, c2):

        return c0 + 4 * c1 + 16 * c2

    dp = [0] * 64

    dp[code(T, T, T)] = 1

    for _ in range(N):

        tmp = [0] * 64

        for p1, p2, p3 in product(list(range(4)), repeat=3):

            for cur in range(4):

                if (p2, p1, cur) == (A, G, C):

                    continue

                if (p2, p1, cur) == (A, C, G):

                    continue

                if (p2, p1, cur) == (G, A, C):

                    continue

                if (p3, p1, cur) == (A, G, C):

                    continue

                if (p3, p2, cur) == (A, G, C):

                    continue

                tmp[code(cur, p1, p2)] += dp[code(p1, p2, p3)]

                tmp[code(cur, p1, p2)] %= MOD

        dp = tmp

    ans = sum(dp)



    return ans % MOD



print((main()))
import sys

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LF():
    return [float(x) for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return input()


from itertools import product
import numpy as np


def main():
    N = II()
    A, G, C, T = 0, 1, 2, 3
    dp = np.zeros((N + 1, 4, 4, 4), int)
    dp[0, T, T, T] = 1
    for n in range(N):
        for p1, p2, p3 in product(range(4), repeat=3):
            for cur in range(4):
                if (p2, p1, cur) == (A, G, C):
                    continue
                if (p2, p1, cur) == (A, C, G):
                    continue
                if (p2, p1, cur) == (G, A, C):
                    continue
                if (p3, p1, cur) == (A, G, C):
                    continue
                if (p3, p2, cur) == (A, G, C):
                    continue
                dp[n + 1, cur, p1, p2] = (
                    dp[n + 1, cur, p1, p2] + dp[n, p1, p2, p3]
                ) % MOD
    ans = np.sum(dp[N])
    return ans % MOD


print(main())

import sys

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LF():
    return [float(x) for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return eval(input())


from itertools import product


def main():
    N = II()
    A, G, C, T = list(range(4))

    def code(c0, c1, c2):
        return c0 + 4 * c1 + 16 * c2

    dp = [0] * 64
    dp[code(T, T, T)] = 1
    for _ in range(N):
        tmp = [0] * 64
        for p1, p2, p3 in product(list(range(4)), repeat=3):
            for cur in range(4):
                if (p2, p1, cur) == (A, G, C):
                    continue
                if (p2, p1, cur) == (A, C, G):
                    continue
                if (p2, p1, cur) == (G, A, C):
                    continue
                if (p3, p1, cur) == (A, G, C):
                    continue
                if (p3, p2, cur) == (A, G, C):
                    continue
                tmp[code(cur, p1, p2)] += dp[code(p1, p2, p3)]
                tmp[code(cur, p1, p2)] %= MOD
        dp = tmp
    ans = sum(dp)
    return ans % MOD


print((main()))

-    return input() +    return eval(input()) -import numpy as np -    A, G, C, T = 0, 1, 2, 3 -    dp = np.zeros((N + 1, 4, 4, 4), int) -    dp[0, T, T, T] = 1 -    for n in range(N): -        for p1, p2, p3 in product(range(4), repeat=3): +    A, G, C, T = list(range(4)) + +    def code(c0, c1, c2): +        return c0 + 4 * c1 + 16 * c2 + +    dp = [0] * 64 +    dp[code(T, T, T)] = 1 +    for _ in range(N): +        tmp = [0] * 64 +        for p1, p2, p3 in product(list(range(4)), repeat=3): -                dp[n + 1, cur, p1, p2] = ( -                    dp[n + 1, cur, p1, p2] + dp[n, p1, p2, p3] -                ) % MOD -    ans = np.sum(dp[N]) +                tmp[code(cur, p1, p2)] += dp[code(p1, p2, p3)] +                tmp[code(cur, p1, p2)] %= MOD +        dp = tmp +    ans = sum(dp) -print(main()) +print((main()))