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

l = ["GACA","GACC","GACT","AGGC","AGCA","AGCG","AGCC","AGCT","AGTC","ACGA","ACGG","ACGC","ACGT","ATGC"]

dict1_y = {}

dict1_n = {}

dict2_y = {}

dict2_n = {}

t = 3

p = 10**9+7

n = int(eval(input()))

for i in a:

    for j in a:

        for k in a:

            s = i + j + k

            dict1_y[s] = 0

            dict1_n[s] = 0

            dict2_y[s] = 0

            dict2_n[s] = 0

for i in a:

    for j in a:

        for k in a:

            s = i + j + k

            if 'AGC' in s:

                dict1_y[s] += 1

            else:

                tem1 = s[0]

                tem2 = s[1]

                new_s = tem2 + tem1 + s[2]

                if 'AGC' in new_s:

                    dict1_y[s] += 1

                else:

                    tem1 = s[1]

                    tem2 = s[2]

                    new_s = s[0] + tem2 + tem1

                    if 'AGC' in new_s:

                        dict1_y[s] += 1

                    else:

                        dict1_n[s] += 1

while t != n:

    for k,v in list(dict1_y.items()):

        for m in a:

            key = m + k[0] + k[1]

            dict2_y[key] += v

    for k,v in list(dict1_n.items()):

        for m in a:

            new_s = m + k

            key = m + k[0] + k[1]

            if new_s in l:

                dict2_y[key] += v

            else:

                dict2_n[key] += v

    for i in a:

        for j in a:

            for k in a:

                s = i + j + k

                dict1_y[s] = dict2_y[s] % p

                dict1_n[s] = dict2_n[s] % p

                dict2_y[s] = 0

                dict2_n[s] = 0

    t += 1

ans = 0

for v in list(dict1_y.values()):

    ans += v % p

print(((4**n - ans) % p))



n = int(eval(input()))

dict = {

3 : 61,

4 : 230 ,

5 : 865 ,

6 : 3247 ,

7 : 12185 ,

8 : 45719 ,

9 : 171531 ,

10 : 643550 ,

11 : 2414454 ,

12 : 9058467 ,

13 : 33985227 ,

14 : 127504505 ,

15 : 478366600 ,

16 : 794717734 ,

17 : 733354121 ,

18 : 261943303 ,

19 : 776803305 ,

20 : 580025381 ,

21 : 51688048 ,

22 : 44657419 ,

23 : 737209731 ,

24 : 604119499 ,

25 : 159693437 ,

26 : 858533109 ,

27 : 639056669 ,

28 : 549054109 ,

29 : 996291083 ,

30 : 531294469 ,

31 : 23314687 ,

32 : 783022045 ,

33 : 855462856 ,

34 : 649970414 ,

35 : 68697295 ,

36 : 409213624 ,

37 : 604356692 ,

38 : 88638656 ,

39 : 978442997 ,

40 : 534833116 ,

41 : 763737161 ,

42 : 785892908 ,

43 : 123883652 ,

44 : 639213333 ,

45 : 181836645 ,

46 : 998121103 ,

47 : 124885216 ,

48 : 501575626 ,

49 : 39816123 ,

50 : 113468411 ,

51 : 799008836 ,

52 : 775465589 ,

53 : 256852905 ,

54 : 664630886 ,

55 : 971550783 ,

56 : 751629411 ,

57 : 51018086 ,

58 : 702530485 ,

59 : 725438992 ,

60 : 696683714 ,

61 : 792638194 ,

62 : 221791721 ,

63 : 149602322 ,

64 : 414054379 ,

65 : 986519078 ,

66 : 981760191 ,

67 : 305799096 ,

68 : 515140586 ,

69 : 406959393 ,

70 : 975058685 ,

71 : 245601370 ,

72 : 324759692 ,

73 : 673385295 ,

74 : 191483611 ,

75 : 570246669 ,

76 : 427196161 ,

77 : 781042769 ,

78 : 569725155 ,

79 : 842176273 ,

80 : 25328739 ,

81 : 847501730 ,

82 : 206282374 ,

83 : 353770801 ,

84 : 323137024 ,

85 : 371653459 ,

86 : 940737264 ,

87 : 123820509 ,

88 : 915711339 ,

89 : 847205021 ,

90 : 252858375 ,

91 : 718889563 ,

92 : 866398347 ,

93 : 738390145 ,

94 : 133009077 ,

95 : 333099663 ,

96 : 170591295 ,

97 : 329869205 ,

98 : 616680192 ,

99 : 597534442 ,

100 : 388130742 

}

print((dict[n]))
a = ["A", "G", "C", "T"]
l = [
    "GACA",
    "GACC",
    "GACT",
    "AGGC",
    "AGCA",
    "AGCG",
    "AGCC",
    "AGCT",
    "AGTC",
    "ACGA",
    "ACGG",
    "ACGC",
    "ACGT",
    "ATGC",
]
dict1_y = {}
dict1_n = {}
dict2_y = {}
dict2_n = {}
t = 3
p = 10**9 + 7
n = int(eval(input()))
for i in a:
    for j in a:
        for k in a:
            s = i + j + k
            dict1_y[s] = 0
            dict1_n[s] = 0
            dict2_y[s] = 0
            dict2_n[s] = 0
for i in a:
    for j in a:
        for k in a:
            s = i + j + k
            if "AGC" in s:
                dict1_y[s] += 1
            else:
                tem1 = s[0]
                tem2 = s[1]
                new_s = tem2 + tem1 + s[2]
                if "AGC" in new_s:
                    dict1_y[s] += 1
                else:
                    tem1 = s[1]
                    tem2 = s[2]
                    new_s = s[0] + tem2 + tem1
                    if "AGC" in new_s:
                        dict1_y[s] += 1
                    else:
                        dict1_n[s] += 1
while t != n:
    for k, v in list(dict1_y.items()):
        for m in a:
            key = m + k[0] + k[1]
            dict2_y[key] += v
    for k, v in list(dict1_n.items()):
        for m in a:
            new_s = m + k
            key = m + k[0] + k[1]
            if new_s in l:
                dict2_y[key] += v
            else:
                dict2_n[key] += v
    for i in a:
        for j in a:
            for k in a:
                s = i + j + k
                dict1_y[s] = dict2_y[s] % p
                dict1_n[s] = dict2_n[s] % p
                dict2_y[s] = 0
                dict2_n[s] = 0
    t += 1
ans = 0
for v in list(dict1_y.values()):
    ans += v % p
print(((4**n - ans) % p))

n = int(eval(input()))
dict = {
    3: 61,
    4: 230,
    5: 865,
    6: 3247,
    7: 12185,
    8: 45719,
    9: 171531,
    10: 643550,
    11: 2414454,
    12: 9058467,
    13: 33985227,
    14: 127504505,
    15: 478366600,
    16: 794717734,
    17: 733354121,
    18: 261943303,
    19: 776803305,
    20: 580025381,
    21: 51688048,
    22: 44657419,
    23: 737209731,
    24: 604119499,
    25: 159693437,
    26: 858533109,
    27: 639056669,
    28: 549054109,
    29: 996291083,
    30: 531294469,
    31: 23314687,
    32: 783022045,
    33: 855462856,
    34: 649970414,
    35: 68697295,
    36: 409213624,
    37: 604356692,
    38: 88638656,
    39: 978442997,
    40: 534833116,
    41: 763737161,
    42: 785892908,
    43: 123883652,
    44: 639213333,
    45: 181836645,
    46: 998121103,
    47: 124885216,
    48: 501575626,
    49: 39816123,
    50: 113468411,
    51: 799008836,
    52: 775465589,
    53: 256852905,
    54: 664630886,
    55: 971550783,
    56: 751629411,
    57: 51018086,
    58: 702530485,
    59: 725438992,
    60: 696683714,
    61: 792638194,
    62: 221791721,
    63: 149602322,
    64: 414054379,
    65: 986519078,
    66: 981760191,
    67: 305799096,
    68: 515140586,
    69: 406959393,
    70: 975058685,
    71: 245601370,
    72: 324759692,
    73: 673385295,
    74: 191483611,
    75: 570246669,
    76: 427196161,
    77: 781042769,
    78: 569725155,
    79: 842176273,
    80: 25328739,
    81: 847501730,
    82: 206282374,
    83: 353770801,
    84: 323137024,
    85: 371653459,
    86: 940737264,
    87: 123820509,
    88: 915711339,
    89: 847205021,
    90: 252858375,
    91: 718889563,
    92: 866398347,
    93: 738390145,
    94: 133009077,
    95: 333099663,
    96: 170591295,
    97: 329869205,
    98: 616680192,
    99: 597534442,
    100: 388130742,
}
print((dict[n]))

-a = ["A", "G", "C", "T"] -l = [ -    "GACA", -    "GACC", -    "GACT", -    "AGGC", -    "AGCA", -    "AGCG", -    "AGCC", -    "AGCT", -    "AGTC", -    "ACGA", -    "ACGG", -    "ACGC", -    "ACGT", -    "ATGC", -] -dict1_y = {} -dict1_n = {} -dict2_y = {} -dict2_n = {} -t = 3 -p = 10**9 + 7 -for i in a: -    for j in a: -        for k in a: -            s = i + j + k -            dict1_y[s] = 0 -            dict1_n[s] = 0 -            dict2_y[s] = 0 -            dict2_n[s] = 0 -for i in a: -    for j in a: -        for k in a: -            s = i + j + k -            if "AGC" in s: -                dict1_y[s] += 1 -            else: -                tem1 = s[0] -                tem2 = s[1] -                new_s = tem2 + tem1 + s[2] -                if "AGC" in new_s: -                    dict1_y[s] += 1 -                else: -                    tem1 = s[1] -                    tem2 = s[2] -                    new_s = s[0] + tem2 + tem1 -                    if "AGC" in new_s: -                        dict1_y[s] += 1 -                    else: -                        dict1_n[s] += 1 -while t != n: -    for k, v in list(dict1_y.items()): -        for m in a: -            key = m + k[0] + k[1] -            dict2_y[key] += v -    for k, v in list(dict1_n.items()): -        for m in a: -            new_s = m + k -            key = m + k[0] + k[1] -            if new_s in l: -                dict2_y[key] += v -            else: -                dict2_n[key] += v -    for i in a: -        for j in a: -            for k in a: -                s = i + j + k -                dict1_y[s] = dict2_y[s] % p -                dict1_n[s] = dict2_n[s] % p -                dict2_y[s] = 0 -                dict2_n[s] = 0 -    t += 1 -ans = 0 -for v in list(dict1_y.values()): -    ans += v % p -print(((4**n - ans) % p)) +dict = { +    3: 61, +    4: 230, +    5: 865, +    6: 3247, +    7: 12185, +    8: 45719, +    9: 171531, +    10: 643550, +    11: 2414454, +    12: 9058467, +    13: 33985227, +    14: 127504505, +    15: 478366600, +    16: 794717734, +    17: 733354121, +    18: 261943303, +    19: 776803305, +    20: 580025381, +    21: 51688048, +    22: 44657419, +    23: 737209731, +    24: 604119499, +    25: 159693437, +    26: 858533109, +    27: 639056669, +    28: 549054109, +    29: 996291083, +    30: 531294469, +    31: 23314687, +    32: 783022045, +    33: 855462856, +    34: 649970414, +    35: 68697295, +    36: 409213624, +    37: 604356692, +    38: 88638656, +    39: 978442997, +    40: 534833116, +    41: 763737161, +    42: 785892908, +    43: 123883652, +    44: 639213333, +    45: 181836645, +    46: 998121103, +    47: 124885216, +    48: 501575626, +    49: 39816123, +    50: 113468411, +    51: 799008836, +    52: 775465589, +    53: 256852905, +    54: 664630886, +    55: 971550783, +    56: 751629411, +    57: 51018086, +    58: 702530485, +    59: 725438992, +    60: 696683714, +    61: 792638194, +    62: 221791721, +    63: 149602322, +    64: 414054379, +    65: 986519078, +    66: 981760191, +    67: 305799096, +    68: 515140586, +    69: 406959393, +    70: 975058685, +    71: 245601370, +    72: 324759692, +    73: 673385295, +    74: 191483611, +    75: 570246669, +    76: 427196161, +    77: 781042769, +    78: 569725155, +    79: 842176273, +    80: 25328739, +    81: 847501730, +    82: 206282374, +    83: 353770801, +    84: 323137024, +    85: 371653459, +    86: 940737264, +    87: 123820509, +    88: 915711339, +    89: 847205021, +    90: 252858375, +    91: 718889563, +    92: 866398347, +    93: 738390145, +    94: 133009077, +    95: 333099663, +    96: 170591295, +    97: 329869205, +    98: 616680192, +    99: 597534442, +    100: 388130742, +} +print((dict[n]))