L = input()

dp1 = [0 for i in range(len(L))]
dp2 = [0 for i in range(len(L))]

dp1[0] = 2
dp2[0] = 1

mod = 10 ** 9 + 7

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

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

dp1 = [0 for i in range(len(L))]
dp2 = [0 for i in range(len(L))]

dp1[0] = 2
dp2[0] = 1

mod = 10 ** 9 + 7

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

print((dp1[len(L)-1] + dp2[len(L)-1]) % mod)