
L = input()
MOD = 10 ** 9 + 7

num = 0
res = 0
n = len(L)
for i in range(n):
    length = n - i - 1
    if L[i] == "1":
        res = (res + pow(2, num, MOD) * pow(3, length, MOD))
        num += 1

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

L = input()
MOD = 10 ** 9 + 7

num = 0
res = 0
n = len(L)
for i in range(n):
    length = n - i - 1
    if L[i] == "1":
        res = (res + pow(2, num, MOD) * pow(3, length, MOD))
        num += 1

res = (res + pow(2, num, MOD)) % MOD
print(res)
