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

x = len(L)
L = int(L, 2)
DP1 = [0] * (x+1)  # sure under L
DP2 = [0] * (x+1)  # possible under L
DP1[1] = 1
DP2[1] = 2
for i in range(2, x+1):
    if (L >> (x-i)) & 1:
        DP1[i] = (DP1[i-1] * 3 + DP2[i-1]) % mod
        DP2[i] = DP2[i-1] * 2 % mod

    else:
        DP1[i] = DP1[i-1] * 3 % mod
        DP2[i] = DP2[i-1]
ans = (DP1[x] + DP2[x]) % mod
print(ans) L = input() L input() input mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 x = len(L) x len(L) len L L = int(L, 2) L int(L, 2) int L 2 DP1 = [0] * (x+1) DP1 [0] * (x+1) [0] 0 x+1 x 1 DP2 = [0] * (x+1) DP2 [0] * (x+1) [0] 0 x+1 x 1 DP1[1] = 1 DP1[1] DP1 1 1 DP2[1] = 2 DP2[1] DP2 1 2 for i in range(2, x+1):
    if (L >> (x-i)) & 1:
        DP1[i] = (DP1[i-1] * 3 + DP2[i-1]) % mod
        DP2[i] = DP2[i-1] * 2 % mod

    else:
        DP1[i] = DP1[i-1] * 3 % mod
        DP2[i] = DP2[i-1] i range(2, x+1) range 2 x+1 x 1 if (L >> (x-i)) & 1:
        DP1[i] = (DP1[i-1] * 3 + DP2[i-1]) % mod
        DP2[i] = DP2[i-1] * 2 % mod

    else:
        DP1[i] = DP1[i-1] * 3 % mod
        DP2[i] = DP2[i-1] (L >> (x-i)) & 1 L >> (x-i) L x-i x i 1 DP1[i] = (DP1[i-1] * 3 + DP2[i-1]) % mod DP1[i] DP1 i (DP1[i-1] * 3 + DP2[i-1]) % mod DP1[i-1] * 3 + DP2[i-1] DP1[i-1] * 3 DP1[i-1] DP1 i-1 i 1 3 DP2[i-1] DP2 i-1 i 1 mod DP2[i] = DP2[i-1] * 2 % mod DP2[i] DP2 i DP2[i-1] * 2 % mod DP2[i-1] * 2 DP2[i-1] DP2 i-1 i 1 2 mod DP1[i] = DP1[i-1] * 3 % mod DP1[i] DP1 i DP1[i-1] * 3 % mod DP1[i-1] * 3 DP1[i-1] DP1 i-1 i 1 3 mod DP2[i] = DP2[i-1] DP2[i] DP2 i DP2[i-1] DP2 i-1 i 1 ans = (DP1[x] + DP2[x]) % mod ans (DP1[x] + DP2[x]) % mod DP1[x] + DP2[x] DP1[x] DP1 x DP2[x] DP2 x mod print(ans) print ans L = input() input() L x = len(L) len(L) x DP2 = [0] * (x+1) [0] * (x+1) DP2 ans = (DP1[x] + DP2[x]) % mod (DP1[x] + DP2[x]) % mod ans DP1 = [0] * (x+1) [0] * (x+1) DP1 mod = 10**9 + 7 10**9 + 7 mod L = int(L, 2) int(L, 2) L
L = input()
mod = 10**9 + 7

x = len(L)
L = int(L, 2)
DP1 = [0] * (x+1)  # sure under L
DP2 = [0] * (x+1)  # possible under L
DP1[1] = 1
DP2[1] = 2
for i in range(2, x+1):
    if (L >> (x-i)) & 1:
        DP1[i] = (DP1[i-1] * 3 + DP2[i-1]) % mod
        DP2[i] = DP2[i-1] * 2 % mod

    else:
        DP1[i] = DP1[i-1] * 3 % mod
        DP2[i] = DP2[i-1]
ans = (DP1[x] + DP2[x]) % mod
print(ans)