CS = ["012".to_i(4), "102".to_i(4), "021".to_i(4)]
CS2 = ["132".to_i(4), "112".to_i(4), "212".to_i(4), "312".to_i(4)]

IS = (0..63).to_a

def init3
  IS.map do |i| CS.include?(i) ? 0: 1 end
end

def f(m, xs)
  if (m == 0)
    sum(xs) % 1000000007
  else
    f(m-1, IS.map do |i| g(xs, i) end)
  end
end

def g(xs, i)
  ab = i / 4
  case i
  when *CS then 0
  when *CS2 then h(xs, ab, [16,32,48])
  else h(xs, ab, [0,16,32,48])
  end
end

def h(xs, ab, js)
  sum(js.map do |j| xs[ab + j] end) % 1000000007
end

def sum(xs)
  xs.inject(0) {|c,x| c + x }
end

n = gets.chomp.to_i

p(f(n-3, init3))
