ll = list(input())

dp1 = [0 for i in range(len(ll))]
dp2 = [0 for i in range(len(ll))]
for idx, l in enumerate(ll):
    if l == "1":
        if idx == 0:
            dp1[0] = 2
            dp2[0] = 1
        else:
            dp1[idx] = dp1[idx-1] * 2
            dp2[idx] = dp2[idx-1] * 3 + dp1[idx-1]
            dp1[idx] %= 10**9+7
            dp2[idx] %= 10**9+7
    else:
        dp1[idx] = dp1[idx-1]
        dp2[idx] = dp2[idx-1] * 3
        dp2[idx] %= 10**9+7

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

dp1 = [0 for i in range(len(ll))]
dp2 = [0 for i in range(len(ll))]
for idx, l in enumerate(ll):
    if l == "1":
        if idx == 0:
            dp1[0] = 2
            dp2[0] = 1
        else:
            dp1[idx] = dp1[idx-1] * 2
            dp2[idx] = dp2[idx-1] * 3 + dp1[idx-1]
            dp1[idx] %= 10**9+7
            dp2[idx] %= 10**9+7
    else:
        dp1[idx] = dp1[idx-1]
        dp2[idx] = dp2[idx-1] * 3
        dp2[idx] %= 10**9+7

print((dp1[-1] + dp2[-1]) % (10**9+7))