pm = 10**9 + 7

l = gets.chomp.split(//)

a = l.inject([1,1]) do |s, x|
  r, b = s
  r3 = (3 * r) % pm
  b2 = (2 * b) % pm
  if x == "1"
    [r3, b2]
  else
    [r3 - b2, b]
  end
end

puts(a[0] % pm)
