L = input()

mod = 10 ** 9 + 7
n = len(L)
dp1 = 0
dp2 = 0

for i in range(n):
    if L[i] == "1":
        dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod
        dp2 = dp2 + 1

dp1 = (dp1 + pow(2, dp2, mod)) % mod
print(dp1) L = input() L input() input mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 n = len(L) n len(L) len L dp1 = 0 dp1 0 dp2 = 0 dp2 0 for i in range(n):
    if L[i] == "1":
        dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod
        dp2 = dp2 + 1 i range(n) range n if L[i] == "1":
        dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod
        dp2 = dp2 + 1 L[i] == "1" L[i] L i "1" dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod dp1 (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod) dp1 pow(2, dp2, mod) * pow(3, n-i-1, mod) pow(2, dp2, mod) pow 2 dp2 mod pow(3, n-i-1, mod) pow 3 n-i-1 n-i n i 1 mod mod dp2 = dp2 + 1 dp2 dp2 + 1 dp2 1 dp1 = (dp1 + pow(2, dp2, mod)) % mod dp1 (dp1 + pow(2, dp2, mod)) % mod dp1 + pow(2, dp2, mod) dp1 pow(2, dp2, mod) pow 2 dp2 mod mod print(dp1) print dp1 L = input() input() L mod = 10 ** 9 + 7 10 ** 9 + 7 mod n = len(L) len(L) n dp2 = 0 0 dp2 dp1 = (dp1 + pow(2, dp2, mod)) % mod (dp1 + pow(2, dp2, mod)) % mod dp1 dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod dp1 dp1 = 0 0 dp1 dp2 = dp2 + 1 dp2 + 1 dp2
L = input()

mod = 10 ** 9 + 7
n = len(L)
dp1 = 0
dp2 = 0

for i in range(n):
    if L[i] == "1":
        dp1 = (dp1 + pow(2, dp2, mod) * pow(3, n-i-1, mod)) % mod
        dp2 = dp2 + 1

dp1 = (dp1 + pow(2, dp2, mod)) % mod
print(dp1)
