l = str(input())
ll = len(l)
mod = 10**9+7

ans = 0
t1 = 0
for i in range(ll):
    if l[i] == "0":
        continue
    ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod
    t1 += 1

ans = (ans+pow(2,t1,mod))%mod

print(ans) l = str(input()) l str(input()) str input() input ll = len(l) ll len(l) len l mod = 10**9+7 mod 10**9+7 10**9 10 9 7 ans = 0 ans 0 t1 = 0 t1 0 for i in range(ll):
    if l[i] == "0":
        continue
    ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod
    t1 += 1 i range(ll) range ll if l[i] == "0":
        continue
     l[i] == "0" l[i] l i "0" continue ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod ans (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod ans pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod pow(2,t1,mod)*pow(3,ll-i-1,mod) pow(2,t1,mod) pow 2 t1 mod pow(3,ll-i-1,mod) pow 3 ll-i-1 ll-i ll i 1 mod mod mod t1 += 1 t1 1 ans = (ans+pow(2,t1,mod))%mod ans (ans+pow(2,t1,mod))%mod ans+pow(2,t1,mod) ans pow(2,t1,mod) pow 2 t1 mod mod print(ans) print ans t1 += 1 1 t1 ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod ans mod = 10**9+7 10**9+7 mod l = str(input()) str(input()) l ll = len(l) len(l) ll ans = 0 0 ans ans = (ans+pow(2,t1,mod))%mod (ans+pow(2,t1,mod))%mod ans t1 = 0 0 t1
l = str(input())
ll = len(l)
mod = 10**9+7

ans = 0
t1 = 0
for i in range(ll):
    if l[i] == "0":
        continue
    ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod
    t1 += 1

ans = (ans+pow(2,t1,mod))%mod

print(ans)
