L = input()
n = len(L)

onecnt = 0
ans = 0

MOD = 10 ** 9 + 7

for i in range(n):
    if L[i] == '0':continue
    onecnt += 1
    rest = n - i - 1
    ans += pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD
    ans %= MOD
ans += pow(2, onecnt, MOD)
print(ans % MOD) L = input() L input() input n = len(L) n len(L) len L onecnt = 0 onecnt 0 ans = 0 ans 0 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 for i in range(n):
    if L[i] == '0':continue
    onecnt += 1
    rest = n - i - 1
    ans += pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD
    ans %= MOD i range(n) range n if L[i] == '0':continue
     L[i] == '0' L[i] L i '0' onecnt += 1 onecnt 1 rest = n - i - 1 rest n - i - 1 n - i n i 1 ans += pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD ans pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) pow(2, onecnt - 1, MOD) pow 2 onecnt - 1 onecnt 1 MOD pow(3, rest, MOD) pow 3 rest MOD MOD ans %= MOD ans MOD ans += pow(2, onecnt, MOD) ans pow(2, onecnt, MOD) pow 2 onecnt MOD print(ans % MOD) print ans % MOD ans MOD ans = 0 0 ans n = len(L) len(L) n onecnt += 1 1 onecnt rest = n - i - 1 n - i - 1 rest MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD L = input() input() L ans %= MOD MOD ans onecnt = 0 0 onecnt ans += pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD ans ans += pow(2, onecnt, MOD) pow(2, onecnt, MOD) ans
L = input()
n = len(L)

onecnt = 0
ans = 0

MOD = 10 ** 9 + 7

for i in range(n):
    if L[i] == '0':continue
    onecnt += 1
    rest = n - i - 1
    ans += pow(2, onecnt - 1, MOD) * pow(3, rest, MOD) % MOD
    ans %= MOD
ans += pow(2, onecnt, MOD)
print(ans % MOD)
