L = gets.chomp.to_s
dp_not_tight = [1]
dp_tight = [2]
L[1..-1].each_char do |char|
  if char == "0"
    dp_not_tight << dp_not_tight.last * 3
    dp_tight << dp_tight.last
  else
    dp_not_tight << dp_not_tight.last * 3 + dp_tight.last
    dp_tight << dp_tight.last * 2
  end
end
puts (dp_not_tight.last + dp_tight.last) % (10 ** 9 + 7)