l = gets.chomp

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

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

ans += 2 ** ones_num

puts (ans % (10**9 + 7))
