l = gets.chomp
n = l.size
M = 10 ** 9 + 7

def pow(x, n)
    n == 0 ? 1 : (n.odd? ? x : 1) * pow(x ** 2 % M, n / 2) % M
end

ans = 0
t = 1
n.times do |i|
    next if l[i] == ?0
    ans = (ans + pow(3, n-i-1) * t) % M
    t = t * 2 % M
end

p (ans + t) % M