def check(a,b,c,d)
  if (a==0 && c==2 && d==1) \
    || (a==0 && b==2 && d==1) \
    || (b==2 && c==0 && d==1) \
    || (b==0 && c==1 && d==2) \
    || (b==0 && c==2 && d==1)
    return false
  else
    return true
  end
end

MOD = 10**9+7
N = gets.to_i
cnt=Array.new(N+1){Array.new(4){Array.new(4){Array.new(4){Array.new(4,0)}}}}
# A:0 C:1 G:2 T:3
4.times do |i|
  4.times do |j|
    4.times do |k|
      cnt[3][3][i][j][k] = 1
    end
  end
end
cnt[3][3][0][2][1] = 0
cnt[3][3][0][1][2] = 0
cnt[3][3][2][0][1] = 0

4.upto(N) do |n|
  4.times do |i|
    4.times do |j|
      4.times do |k|
        4.times do |l|
          if check(i,j,k,l)
            4.times do |m|
              cnt[n][i][j][k][l] += cnt[n-1][m][i][j][k]
              cnt[n][i][j][k][l] %= MOD
            end
          end
        end
      end
    end
  end
end

ans = 0
4.times do |i|
  4.times do |j|
    4.times do |k|
      4.times do |l|
        ans += cnt[N][i][j][k][l]
        ans %= MOD
      end
    end
  end
end
p ans