Mod = 10**9 + 7
L = gets.chomp

non_free, free = [1, 0]
L.chars.each{ |c|
  non_free, free = case c
  when "1"; [non_free*2 % Mod, (non_free + free*3) % Mod]
  when "0"; [non_free % Mod, free*3 % Mod]
  end
}
p (free + non_free) % Mod
