l=gets.chomp
p l
def f(n,s)
    if s.size==0
        (2**n)
    elsif s[0]=="1" 
       (2**n)*(3**(s.size-1)) + f(n+1,s[1,s.size-1]) 
    else
        f(n,s[1,s.size-1])
    end
    
end

p f(0,l)% (10**9+7)