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

x = len(L)
L = int(L, 2)
sure = 1
possible = 2
for i in range(2, x+1):
    if (L >> (x-i)) & 1:
        sure = (sure * 3 + possible) % mod
        possible = possible * 2 % mod

    else:
        sure = sure * 3 % mod
        
ans = (sure + possible) % 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 sure = 1 sure 1 possible = 2 possible 2 for i in range(2, x+1):
    if (L >> (x-i)) & 1:
        sure = (sure * 3 + possible) % mod
        possible = possible * 2 % mod

    else:
        sure = sure * 3 % mod
         i range(2, x+1) range 2 x+1 x 1 if (L >> (x-i)) & 1:
        sure = (sure * 3 + possible) % mod
        possible = possible * 2 % mod

    else:
        sure = sure * 3 % mod
         (L >> (x-i)) & 1 L >> (x-i) L x-i x i 1 sure = (sure * 3 + possible) % mod sure (sure * 3 + possible) % mod sure * 3 + possible sure * 3 sure 3 possible mod possible = possible * 2 % mod possible possible * 2 % mod possible * 2 possible 2 mod sure = sure * 3 % mod sure sure * 3 % mod sure * 3 sure 3 mod ans = (sure + possible) % mod ans (sure + possible) % mod sure + possible sure possible mod print(ans) print ans L = input() input() L sure = (sure * 3 + possible) % mod (sure * 3 + possible) % mod sure sure = sure * 3 % mod sure * 3 % mod sure ans = (sure + possible) % mod (sure + possible) % mod ans L = int(L, 2) int(L, 2) L x = len(L) len(L) x sure = 1 1 sure possible = possible * 2 % mod possible * 2 % mod possible mod = 10**9 + 7 10**9 + 7 mod possible = 2 2 possible
L = input()
mod = 10**9 + 7

x = len(L)
L = int(L, 2)
sure = 1
possible = 2
for i in range(2, x+1):
    if (L >> (x-i)) & 1:
        sure = (sure * 3 + possible) % mod
        possible = possible * 2 % mod

    else:
        sure = sure * 3 % mod
        
ans = (sure + possible) % mod
print(ans)