N, MOD = int(eval(input())), 10 ** 9 + 7

memo = [{} for _ in range(101)]



def ok(last4):

    for i in range(4):

        t = list(last4)

        if i >= 1:

            t[i-1], t[i] = t[i], t[i-1]

        if ''.join(t).find('AGC') != -1:

            return False

    return True



def dfs(cur, last3):

    if last3 in memo[cur]:

        return memo[cur][last3]

    if cur == N:

        return 1

    ret = 0

    for c in 'ACGT':

        if ok(last3 + c):

            ret = (ret + dfs(cur+1, last3[1:] + c)) % MOD

    memo[cur][last3] = ret

    return ret



print((dfs(0, 'TTT')))



N = int(eval(input()))

MOD = 10 ** 9 + 7



memo = [{} for _ in range(N)]



def ok(last4):

    if last4.find('AGC') != -1:

        return False

    for i in range(3):

        t = list(last4)

        t[i], t[i+1] = t[i+1], t[i]

        if ''.join(t).find('AGC') != -1:

            return False

    return True



def dfs(i, last3):

    if i == N:

        return 1

    if last3 in memo[i]:

        return memo[i][last3]

    ret = 0

    for s in 'ACGT':

        if ok(last3+s):

            ret = (ret + dfs(i+1, last3[1:]+s)) % MOD

    memo[i][last3] = ret

    return ret



answer = dfs(0, 'TTT')

print(answer)

N, MOD = int(eval(input())), 10**9 + 7
memo = [{} for _ in range(101)]


def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if "".join(t).find("AGC") != -1:
            return False
    return True


def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in "ACGT":
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret


print((dfs(0, "TTT")))

N = int(eval(input()))
MOD = 10**9 + 7
memo = [{} for _ in range(N)]


def ok(last4):
    if last4.find("AGC") != -1:
        return False
    for i in range(3):
        t = list(last4)
        t[i], t[i + 1] = t[i + 1], t[i]
        if "".join(t).find("AGC") != -1:
            return False
    return True


def dfs(i, last3):
    if i == N:
        return 1
    if last3 in memo[i]:
        return memo[i][last3]
    ret = 0
    for s in "ACGT":
        if ok(last3 + s):
            ret = (ret + dfs(i + 1, last3[1:] + s)) % MOD
    memo[i][last3] = ret
    return ret


answer = dfs(0, "TTT")
print(answer)

-N, MOD = int(eval(input())), 10**9 + 7 -memo = [{} for _ in range(101)] +N = int(eval(input())) +MOD = 10**9 + 7 +memo = [{} for _ in range(N)] -    for i in range(4): +    if last4.find("AGC") != -1: +        return False +    for i in range(3): -        if i >= 1: -            t[i - 1], t[i] = t[i], t[i - 1] +        t[i], t[i + 1] = t[i + 1], t[i] -def dfs(cur, last3): -    if last3 in memo[cur]: -        return memo[cur][last3] -    if cur == N: +def dfs(i, last3): +    if i == N: +    if last3 in memo[i]: +        return memo[i][last3] -    for c in "ACGT": -        if ok(last3 + c): -            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD -    memo[cur][last3] = ret +    for s in "ACGT": +        if ok(last3 + s): +            ret = (ret + dfs(i + 1, last3[1:] + s)) % MOD +    memo[i][last3] = ret -print((dfs(0, "TTT"))) +answer = dfs(0, "TTT") +print(answer)