p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
L = list(map(int,list(input().strip())))
N = len(L)
A = []
for i in range(N):
    if L[i]==1:
        A.append(i)
cnt = 0
for i in range(len(A)):
    j = A[i]
    k = i
    n = N-1-j
    cnt = (cnt+pow(2,k)*pow(3,n))%p
cnt = (cnt+pow(2,len(A)))%p
print(cnt) p = 10**9+7 p 10**9+7 10**9 10 9 7 def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p pow if m==0:
        return 1
     m==0 m 0 return 1 1 if m==1:
        return x
     m==1 m 1 return x x if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p m%2==0 m%2 m 2 0 return (pow(x,m//2)**2)%p (pow(x,m//2)**2)%p pow(x,m//2)**2 pow(x,m//2) pow x m//2 m 2 2 p return (x*(pow(x,(m-1)//2)**2)%p)%p (x*(pow(x,(m-1)//2)**2)%p)%p x*(pow(x,(m-1)//2)**2)%p x*(pow(x,(m-1)//2)**2) x pow(x,(m-1)//2)**2 pow(x,(m-1)//2) pow x (m-1)//2 m-1 m 1 2 2 p p x x m m L = list(map(int,list(input().strip()))) L list(map(int,list(input().strip()))) list map(int,list(input().strip())) map int list(input().strip()) list input().strip() ().strip () input strip N = len(L) N len(L) len L A = [] A [] for i in range(N):
    if L[i]==1:
        A.append(i) i range(N) range N if L[i]==1:
        A.append(i) L[i]==1 L[i] L i 1 A.append(i) A.append A append i cnt = 0 cnt 0 for i in range(len(A)):
    j = A[i]
    k = i
    n = N-1-j
    cnt = (cnt+pow(2,k)*pow(3,n))%p i range(len(A)) range len(A) len A j = A[i] j A[i] A i k = i k i n = N-1-j n N-1-j N-1 N 1 j cnt = (cnt+pow(2,k)*pow(3,n))%p cnt (cnt+pow(2,k)*pow(3,n))%p cnt+pow(2,k)*pow(3,n) cnt pow(2,k)*pow(3,n) pow(2,k) pow 2 k pow(3,n) pow 3 n p cnt = (cnt+pow(2,len(A)))%p cnt (cnt+pow(2,len(A)))%p cnt+pow(2,len(A)) cnt pow(2,len(A)) pow 2 len(A) len A p print(cnt) print cnt p = 10**9+7 10**9+7 p def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p pow cnt = (cnt+pow(2,len(A)))%p (cnt+pow(2,len(A)))%p cnt k = i i k cnt = (cnt+pow(2,k)*pow(3,n))%p (cnt+pow(2,k)*pow(3,n))%p cnt n = N-1-j N-1-j n cnt = 0 0 cnt j = A[i] A[i] j A = [] [] A L = list(map(int,list(input().strip()))) list(map(int,list(input().strip()))) L N = len(L) len(L) N
p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
L = list(map(int,list(input().strip())))
N = len(L)
A = []
for i in range(N):
    if L[i]==1:
        A.append(i)
cnt = 0
for i in range(len(A)):
    j = A[i]
    k = i
    n = N-1-j
    cnt = (cnt+pow(2,k)*pow(3,n))%p
cnt = (cnt+pow(2,len(A)))%p
print(cnt)