l = gets.chomp

ones = l.reverse.chars.each_with_index.select {|b, _| b == '1' }.map(&:last)
ones_num = ones.size

DIVISOR = 10**9 + 7

ans = ones.each_with_index.map do |i, k|
  (3.pow(i, DIVISOR)) * (2.pow(ones_num - k - 1, DIVISOR))
end.inject(:+)

ans += 2 ** ones_num

puts (ans % DIVISOR)
