l = list(map(int, list(input())))
n = len(l) + 1
MOD = 10**9+7
dp1 = [0 for _ in range(n)]
dp2 = [0 for _ in range(n)]
dp1[0] = 1
for i in range(1, n):
    if l[i-1] == 1:
        dp1[i] = dp1[i-1] * 2
        dp2[i] = dp1[i-1] + dp2[i-1] * 3
    else:
        dp1[i] = dp1[i-1]
        dp2[i] = dp2[i-1] * 3
    dp1[i] %= MOD
    dp2[i] %= MOD
print((dp1[-1] + dp2[-1]) % MOD) l = list(map(int, list(input()))) l list(map(int, list(input()))) list map(int, list(input())) map int list(input()) list input() input n = len(l) + 1 n len(l) + 1 len(l) len l 1 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 0 for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) 0 dp1 = [0 for _ in range(n)] dp1 [0 for _ in range(n)] 0 for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) 0 dp2 = [0 for _ in range(n)] dp2 [0 for _ in range(n)] dp1[0] = 1 dp1[0] dp1 0 1 for i in range(1, n):
    if l[i-1] == 1:
        dp1[i] = dp1[i-1] * 2
        dp2[i] = dp1[i-1] + dp2[i-1] * 3
    else:
        dp1[i] = dp1[i-1]
        dp2[i] = dp2[i-1] * 3
    dp1[i] %= MOD
    dp2[i] %= MOD i range(1, n) range 1 n if l[i-1] == 1:
        dp1[i] = dp1[i-1] * 2
        dp2[i] = dp1[i-1] + dp2[i-1] * 3
    else:
        dp1[i] = dp1[i-1]
        dp2[i] = dp2[i-1] * 3
     l[i-1] == 1 l[i-1] l i-1 i 1 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-1] * 3 dp2[i] dp2 i dp1[i-1] + dp2[i-1] * 3 dp1[i-1] dp1 i-1 i 1 dp2[i-1] * 3 dp2[i-1] dp2 i-1 i 1 3 dp1[i] = dp1[i-1] dp1[i] dp1 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[-1] + dp2[-1]) % MOD) print (dp1[-1] + dp2[-1]) % MOD dp1[-1] + dp2[-1] dp1[-1] dp1 -1 dp2[-1] dp2 -1 MOD dp2 = [0 for _ in range(n)] [0 for _ in range(n)] dp2 dp1 = [0 for _ in range(n)] [0 for _ in range(n)] dp1 MOD = 10**9+7 10**9+7 MOD l = list(map(int, list(input()))) list(map(int, list(input()))) l n = len(l) + 1 len(l) + 1 n
l = list(map(int, list(input())))
n = len(l) + 1
MOD = 10**9+7
dp1 = [0 for _ in range(n)]
dp2 = [0 for _ in range(n)]
dp1[0] = 1
for i in range(1, n):
    if l[i-1] == 1:
        dp1[i] = dp1[i-1] * 2
        dp2[i] = dp1[i-1] + dp2[i-1] * 3
    else:
        dp1[i] = dp1[i-1]
        dp2[i] = dp2[i-1] * 3
    dp1[i] %= MOD
    dp2[i] %= MOD
print((dp1[-1] + dp2[-1]) % MOD)