l = input()
dp = [1, 0]
mod = 10**9+7
for i in l:
    newdp = dp[:]
    if i=='0':
        newdp[0] = dp[0]
        newdp[1] = dp[1]*3%mod
    else:
        newdp[0] = dp[0]*2%mod
        newdp[1] = (dp[0]+dp[1]*3)%mod
    dp = newdp
print(sum(dp)%mod) l = input() l input() input dp = [1, 0] dp [1, 0] 1 0 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 for i in l:
    newdp = dp[:]
    if i=='0':
        newdp[0] = dp[0]
        newdp[1] = dp[1]*3%mod
    else:
        newdp[0] = dp[0]*2%mod
        newdp[1] = (dp[0]+dp[1]*3)%mod
    dp = newdp i l newdp = dp[:] newdp dp[:] dp : if i=='0':
        newdp[0] = dp[0]
        newdp[1] = dp[1]*3%mod
    else:
        newdp[0] = dp[0]*2%mod
        newdp[1] = (dp[0]+dp[1]*3)%mod
     i=='0' i '0' newdp[0] = dp[0] newdp[0] newdp 0 dp[0] dp 0 newdp[1] = dp[1]*3%mod newdp[1] newdp 1 dp[1]*3%mod dp[1]*3 dp[1] dp 1 3 mod newdp[0] = dp[0]*2%mod newdp[0] newdp 0 dp[0]*2%mod dp[0]*2 dp[0] dp 0 2 mod newdp[1] = (dp[0]+dp[1]*3)%mod newdp[1] newdp 1 (dp[0]+dp[1]*3)%mod dp[0]+dp[1]*3 dp[0] dp 0 dp[1]*3 dp[1] dp 1 3 mod dp = newdp dp newdp print(sum(dp)%mod) print sum(dp)%mod sum(dp) sum dp mod l = input() input() l mod = 10**9+7 10**9+7 mod dp = newdp newdp dp dp = [1, 0] [1, 0] dp newdp = dp[:] dp[:] newdp
l = input()
dp = [1, 0]
mod = 10**9+7
for i in l:
    newdp = dp[:]
    if i=='0':
        newdp[0] = dp[0]
        newdp[1] = dp[1]*3%mod
    else:
        newdp[0] = dp[0]*2%mod
        newdp[1] = (dp[0]+dp[1]*3)%mod
    dp = newdp
print(sum(dp)%mod)