import sys
sys.setrecursionlimit(10**9)
l=list(input())
n=len(l)
p=10**9+7
ans=0
d=0
def f(n,k,q):
    if k==0:
        return 1
    elif k%2==0:
        return ((f(n,k//2,q))**2)%q
    else:
        return (n*f(n,k-1,q))%q

for i in range(n):
    if l[i]=="1":
        x=n-i-1
        ans+=(f(3,x,p)*f(2,d,p))%p
        d+=1
    else:
        continue

ans+=f(2,d,p)
print(ans%p) import sys sys sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 l=list(input()) l list(input()) list input() input n=len(l) n len(l) len l p=10**9+7 p 10**9+7 10**9 10 9 7 ans=0 ans 0 d=0 d 0 def f(n,k,q):
    if k==0:
        return 1
    elif k%2==0:
        return ((f(n,k//2,q))**2)%q
    else:
        return (n*f(n,k-1,q))%q f if k==0:
        return 1
    elif k%2==0:
        return ((f(n,k//2,q))**2)%q
    else:
        return (n*f(n,k-1,q))%q k==0 k 0 return 1 1 elif k%2==0:
        return ((f(n,k//2,q))**2)%q
     k%2==0 k%2 k 2 0 return ((f(n,k//2,q))**2)%q ((f(n,k//2,q))**2)%q (f(n,k//2,q))**2 f(n,k//2,q) f n k//2 k 2 q 2 q return (n*f(n,k-1,q))%q (n*f(n,k-1,q))%q n*f(n,k-1,q) n f(n,k-1,q) f n k-1 k 1 q q n n k k q q for i in range(n):
    if l[i]=="1":
        x=n-i-1
        ans+=(f(3,x,p)*f(2,d,p))%p
        d+=1
    else:
        continue i range(n) range n if l[i]=="1":
        x=n-i-1
        ans+=(f(3,x,p)*f(2,d,p))%p
        d+=1
    else:
        continue l[i]=="1" l[i] l i "1" x=n-i-1 x n-i-1 n-i n i 1 ans+=(f(3,x,p)*f(2,d,p))%p ans (f(3,x,p)*f(2,d,p))%p f(3,x,p)*f(2,d,p) f(3,x,p) f 3 x p f(2,d,p) f 2 d p p d+=1 d 1 continue ans+=f(2,d,p) ans f(2,d,p) f 2 d p print(ans%p) print ans%p ans p ans+=f(2,d,p) f(2,d,p) ans p=10**9+7 10**9+7 p x=n-i-1 n-i-1 x ans=0 0 ans def f(n,k,q):
    if k==0:
        return 1
    elif k%2==0:
        return ((f(n,k//2,q))**2)%q
    else:
        return (n*f(n,k-1,q))%q def f(n,k,q):
    if k==0:
        return 1
    elif k%2==0:
        return ((f(n,k//2,q))**2)%q
    else:
        return (n*f(n,k-1,q))%q f ans+=(f(3,x,p)*f(2,d,p))%p (f(3,x,p)*f(2,d,p))%p ans l=list(input()) list(input()) l d+=1 1 d n=len(l) len(l) n d=0 0 d
import sys
sys.setrecursionlimit(10**9)
l=list(input())
n=len(l)
p=10**9+7
ans=0
d=0
def f(n,k,q):
    if k==0:
        return 1
    elif k%2==0:
        return ((f(n,k//2,q))**2)%q
    else:
        return (n*f(n,k-1,q))%q

for i in range(n):
    if l[i]=="1":
        x=n-i-1
        ans+=(f(3,x,p)*f(2,d,p))%p
        d+=1
    else:
        continue

ans+=f(2,d,p)
print(ans%p)
