L=list(map(int,list(input())))
n=len(L)
mod=10**9+7
table=[None]*n
table[0]=1
for i in range(1,n):
    table[i]=3*table[i-1]%mod
ans=0
k=1
for i in range(n):
    if L[i]==1:
        ans=(ans+k*table[n-i-1])%mod
        k=k*2%mod
ans+=k    
print(ans%mod) L=list(map(int,list(input()))) L list(map(int,list(input()))) list map(int,list(input())) map int list(input()) list input() input n=len(L) n len(L) len L mod=10**9+7 mod 10**9+7 10**9 10 9 7 table=[None]*n table [None]*n [None] None n table[0]=1 table[0] table 0 1 for i in range(1,n):
    table[i]=3*table[i-1]%mod i range(1,n) range 1 n table[i]=3*table[i-1]%mod table[i] table i 3*table[i-1]%mod 3*table[i-1] 3 table[i-1] table i-1 i 1 mod ans=0 ans 0 k=1 k 1 for i in range(n):
    if L[i]==1:
        ans=(ans+k*table[n-i-1])%mod
        k=k*2%mod i range(n) range n if L[i]==1:
        ans=(ans+k*table[n-i-1])%mod
        k=k*2%mod L[i]==1 L[i] L i 1 ans=(ans+k*table[n-i-1])%mod ans (ans+k*table[n-i-1])%mod ans+k*table[n-i-1] ans k*table[n-i-1] k table[n-i-1] table n-i-1 n-i n i 1 mod k=k*2%mod k k*2%mod k*2 k 2 mod ans+=k ans k print(ans%mod) print ans%mod ans mod n=len(L) len(L) n table=[None]*n [None]*n table ans=0 0 ans L=list(map(int,list(input()))) list(map(int,list(input()))) L mod=10**9+7 10**9+7 mod ans=(ans+k*table[n-i-1])%mod (ans+k*table[n-i-1])%mod ans ans+=k k ans k=1 1 k k=k*2%mod k*2%mod k
L=list(map(int,list(input())))
n=len(L)
mod=10**9+7
table=[None]*n
table[0]=1
for i in range(1,n):
    table[i]=3*table[i-1]%mod
ans=0
k=1
for i in range(n):
    if L[i]==1:
        ans=(ans+k*table[n-i-1])%mod
        k=k*2%mod
ans+=k    
print(ans%mod)