l = input().rstrip()
n = len(l)

mod = 10**9 + 7
c = 1
d = 0
for i in range(n):
    d *= 3
    if l[i] == '1':
        d += c
        c <<= 1
    d %= mod
    c %= mod

print((c+d)%mod) l = input().rstrip() l input().rstrip() ().rstrip () input rstrip n = len(l) n len(l) len l mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 c = 1 c 1 d = 0 d 0 for i in range(n):
    d *= 3
    if l[i] == '1':
        d += c
        c <<= 1
    d %= mod
    c %= mod i range(n) range n d *= 3 d 3 if l[i] == '1':
        d += c
        c <<= 1
     l[i] == '1' l[i] l i '1' d += c d c c <<= 1 c 1 d %= mod d mod c %= mod c mod print((c+d)%mod) print (c+d)%mod c+d c d mod mod = 10**9 + 7 10**9 + 7 mod c <<= 1 1 c c %= mod mod c d = 0 0 d n = len(l) len(l) n d += c c d c = 1 1 c d %= mod mod d d *= 3 3 d l = input().rstrip() input().rstrip() l
l = input().rstrip()
n = len(l)

mod = 10**9 + 7
c = 1
d = 0
for i in range(n):
    d *= 3
    if l[i] == '1':
        d += c
        c <<= 1
    d %= mod
    c %= mod

print((c+d)%mod)