N = gets.to_i
MOD = 10 ** 9 + 7

dp = Array.new(N - 1) { Array.new(64, 0) }

64.times do |j|
  dp[0][j] = 1
end

dp[0][6] = 0
dp[0][9] = 0
dp[0][33] = 0

(0..(N - 4)).each do |i|
  64.times do |j|
    white_list = case j
                 when 0
                   # AAA
                   [0, 1, 2, 3]
                 when 1
                   # AAC
                   [4, 5, 7]
                 when 2
                   # AAG
                   [8, 10, 11]
                 when 3
                   # AAT
                   [12, 13, 14, 15]
                 when 4
                   # ACA
                   [0, 1, 2, 3]
                 when 5
                   # ACC
                   [20, 21, 22, 23]
                 when 6
                   # ACG
                   [24, 25, 26, 27]
                 when 7
                   # ACT
                   [28, 29, 30, 31]
                 when 8
                   # AGA
                   [32, 34, 35]
                 when 9
                   # AGC
                   [36, 37, 38, 39]
                 when 10
                   # AGG
                   [40, 42, 43]
                 when 11
                   # AGT
                   [43, 44, 46]
                 when 12
                   # ATA
                   [48, 49, 50, 51]
                 when 13
                   # ATC
                   [52, 53, 54, 55]
                 when 14
                   # ATG
                   [56, 58, 59]
                 when 15
                   # ATT
                   [60, 61, 62, 63]
                 when 16
                   # CAA
                   [0, 1, 2, 3]
                 when 17
                   # CAC
                   [4, 5, 7]
                 when 18
                   # CAG
                   [8, 10, 11]
                 when 19
                   # CAT
                   [12, 13, 14, 15]
                 when 20
                   # CCA
                   [16, 17, 18, 19]
                 when 21
                   # CCC
                   [20, 21, 22, 23]
                 when 22
                   # CCG
                   [24, 25, 26, 27]
                 when 23
                   # CCT
                   [28, 29, 30, 31]
                 when 24
                   # CGA
                   [32, 34, 35]
                 when 25
                   # CGC
                   [36, 37, 38, 39]
                 when 26
                   # CGG
                   [40, 41, 42, 43]
                 when 27
                   # CGT
                   [44, 45, 46, 47]
                 when 28
                   # CTA
                   [48, 49, 50, 51]
                 when 29
                   # CTC
                   [52, 53, 54, 55]
                 when 30
                   # CTG
                   [56, 57, 58, 59]
                 when 31
                   # CTT
                   [60, 61, 62, 63]
                 when 32
                   # GAA
                   [0, 1, 2, 3]
                 when 33
                   # GAC
                   [4, 5, 7]
                 when 34
                   # GAG
                   [8, 10, 11]
                 when 35
                   # GAT
                   [12, 13, 14, 15]
                 when 36
                   # GCA
                   [16, 17, 18, 19]
                 when 37
                   # GCC
                   [20, 21, 22, 23]
                 when 38
                   # GCG
                   [24, 25, 26, 27]
                 when 39
                   # GCT
                   [28, 29, 30, 31]
                 when 40
                   # GGA
                   [32, 34, 35]
                 when 41
                   # GGC
                   [36, 37, 38, 39]
                 when 42
                   # GGG
                   [40, 41, 42, 43]
                 when 43
                   # GGT
                   [44, 45, 46, 47]
                 when 44
                   # GTA
                   [48, 49, 50, 51]
                 when 45
                   # GTC
                   [52, 53, 54, 55]
                 when 46
                   # GTG
                   [56, 57, 58, 59]
                 when 47
                   # GTT
                   [60, 61, 62, 63]
                 when 48
                   # TAA
                   [0, 1, 2, 3]
                 when 49
                   # TAC
                   [4, 5, 7]
                 when 50
                   # TAG
                   [8, 10, 11]
                 when 51
                   # TAT
                   [12, 13, 14, 15]
                 when 52
                   # TCA
                   [16, 17, 18, 19]
                 when 53
                   # TCC
                   [20, 21, 22, 23]
                 when 54
                   # TCG
                   [24, 25, 26, 27]
                 when 55
                   # TCT
                   [28, 29, 30, 31]
                 when 56
                   # TGA
                   [32, 34, 35]
                 when 57
                   # TGC
                   [36, 37, 38, 39]
                 when 58
                   # TGG
                   [40, 41, 42, 43]
                 when 59
                   # TGT
                   [43, 44, 45, 46]
                 when 60
                   # TTA
                   [48, 49, 50, 51]
                 when 61
                   # TTC
                   [52, 53, 54, 55]
                 when 62
                   # TTG
                   [56, 57, 58, 59]
                 when 63
                   # TTT
                   [60, 61, 62, 63]
                 end

    64.times do |k|
      next unless white_list.include?(k)

      dp[i + 1][k] = (dp[i + 1][k] + dp[i][j]) % MOD
    end
  end
end

p dp[N - 3].inject(:+) % MOD
