MOD = 10**9 + 7
l = input()
dp = [1, 0] # bounded, unbounded
ndp = [0, 0]

for c in l:
    ndp1 = dp[1] * 3
    if c == '1':
        ndp0 = dp[0] * 2
        ndp1 += dp[0]
    else:
        ndp0 = dp[0]
    dp = ndp0 % MOD, ndp1 % MOD
print(sum(dp) % MOD) MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 l = input() l input() input dp = [1, 0] dp [1, 0] 1 0 ndp = [0, 0] ndp [0, 0] 0 0 for c in l:
    ndp1 = dp[1] * 3
    if c == '1':
        ndp0 = dp[0] * 2
        ndp1 += dp[0]
    else:
        ndp0 = dp[0]
    dp = ndp0 % MOD, ndp1 % MOD c l ndp1 = dp[1] * 3 ndp1 dp[1] * 3 dp[1] dp 1 3 if c == '1':
        ndp0 = dp[0] * 2
        ndp1 += dp[0]
    else:
        ndp0 = dp[0]
     c == '1' c '1' ndp0 = dp[0] * 2 ndp0 dp[0] * 2 dp[0] dp 0 2 ndp1 += dp[0] ndp1 dp[0] dp 0 ndp0 = dp[0] ndp0 dp[0] dp 0 dp = ndp0 % MOD, ndp1 % MOD dp dp = ndp0 % MOD, ndp1 % MOD ndp0 % MOD ndp0 MOD ndp1 % MOD ndp1 MOD print(sum(dp) % MOD) print sum(dp) % MOD sum(dp) sum dp MOD ndp0 = dp[0] * 2 dp[0] * 2 ndp0 l = input() input() l ndp1 += dp[0] dp[0] ndp1 MOD = 10**9 + 7 10**9 + 7 MOD ndp = [0, 0] [0, 0] ndp dp = ndp0 % MOD, ndp1 % MOD dp = ndp0 % MOD, ndp1 % MOD dp ndp1 = dp[1] * 3 dp[1] * 3 ndp1 dp = [1, 0] [1, 0] dp ndp0 = dp[0] dp[0] ndp0
MOD = 10**9 + 7
l = input()
dp = [1, 0] # bounded, unbounded
ndp = [0, 0]

for c in l:
    ndp1 = dp[1] * 3
    if c == '1':
        ndp0 = dp[0] * 2
        ndp1 += dp[0]
    else:
        ndp0 = dp[0]
    dp = ndp0 % MOD, ndp1 % MOD
print(sum(dp) % MOD)
