L = input()

mod = 10 ** 9 + 7
n = len(L)
dp1 = 1
dp2 = 0

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

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

mod = 10 ** 9 + 7
n = len(L)
dp1 = 1
dp2 = 0

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

print((dp1 + dp2) % mod)
