MOD = 10**9+7
l = input()
n = len(l)
dp = [[[0] * 2 for _ in range(3)] for _ in range(n+1)]
dp[0][0][1] = 1

for i in range(n):
    for j in range(3):
        dp[i][j][0] %= MOD
        dp[i][j][1] %= MOD
        dp[i+1][0][0] += dp[i][j][0]
        dp[i+1][1][0] += dp[i][j][0]
        dp[i+1][2][0] += dp[i][j][0]
        if l[i] == "1":
            dp[i+1][1][1] += dp[i][j][1]
            dp[i+1][2][1] += dp[i][j][1]
            dp[i+1][0][0] += dp[i][j][1]
        else:
            dp[i+1][0][1] += dp[i][j][1]

print(sum(map(lambda x: sum(x) % MOD, dp[n])) % MOD)  MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 l = input() l input() input n = len(l) n len(l) len l [[0] * 2 for _ in range(3)] for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) [[0] * 2 for _ in range(3)] dp = [[[0] * 2 for _ in range(3)] for _ in range(n+1)] dp [[[0] * 2 for _ in range(3)] for _ in range(n+1)] dp[0][0][1] = 1 dp[0][0][1] [0] [0] dp 0 0 1 1 for i in range(n):
    for j in range(3):
        dp[i][j][0] %= MOD
        dp[i][j][1] %= MOD
        dp[i+1][0][0] += dp[i][j][0]
        dp[i+1][1][0] += dp[i][j][0]
        dp[i+1][2][0] += dp[i][j][0]
        if l[i] == "1":
            dp[i+1][1][1] += dp[i][j][1]
            dp[i+1][2][1] += dp[i][j][1]
            dp[i+1][0][0] += dp[i][j][1]
        else:
            dp[i+1][0][1] += dp[i][j][1] i range(n) range n for j in range(3):
        dp[i][j][0] %= MOD
        dp[i][j][1] %= MOD
        dp[i+1][0][0] += dp[i][j][0]
        dp[i+1][1][0] += dp[i][j][0]
        dp[i+1][2][0] += dp[i][j][0]
        if l[i] == "1":
            dp[i+1][1][1] += dp[i][j][1]
            dp[i+1][2][1] += dp[i][j][1]
            dp[i+1][0][0] += dp[i][j][1]
        else:
            dp[i+1][0][1] += dp[i][j][1] j range(3) range 3 dp[i][j][0] %= MOD dp[i][j][0] [j] [i] dp i j 0 MOD dp[i][j][1] %= MOD dp[i][j][1] [j] [i] dp i j 1 MOD dp[i+1][0][0] += dp[i][j][0] dp[i+1][0][0] [0] [i+1] dp i+1 i 1 0 0 dp[i][j][0] [j] [i] dp i j 0 dp[i+1][1][0] += dp[i][j][0] dp[i+1][1][0] [1] [i+1] dp i+1 i 1 1 0 dp[i][j][0] [j] [i] dp i j 0 dp[i+1][2][0] += dp[i][j][0] dp[i+1][2][0] [2] [i+1] dp i+1 i 1 2 0 dp[i][j][0] [j] [i] dp i j 0 if l[i] == "1":
            dp[i+1][1][1] += dp[i][j][1]
            dp[i+1][2][1] += dp[i][j][1]
            dp[i+1][0][0] += dp[i][j][1]
        else:
            dp[i+1][0][1] += dp[i][j][1] l[i] == "1" l[i] l i "1" dp[i+1][1][1] += dp[i][j][1] dp[i+1][1][1] [1] [i+1] dp i+1 i 1 1 1 dp[i][j][1] [j] [i] dp i j 1 dp[i+1][2][1] += dp[i][j][1] dp[i+1][2][1] [2] [i+1] dp i+1 i 1 2 1 dp[i][j][1] [j] [i] dp i j 1 dp[i+1][0][0] += dp[i][j][1] dp[i+1][0][0] [0] [i+1] dp i+1 i 1 0 0 dp[i][j][1] [j] [i] dp i j 1 dp[i+1][0][1] += dp[i][j][1] dp[i+1][0][1] [0] [i+1] dp i+1 i 1 0 1 dp[i][j][1] [j] [i] dp i j 1 print(sum(map(lambda x: sum(x) % MOD, dp[n])) % MOD) print sum(map(lambda x: sum(x) % MOD, dp[n])) % MOD sum(map(lambda x: sum(x) % MOD, dp[n])) sum map(lambda x: sum(x) % MOD, dp[n]) map lambda x: sum(x) % MOD sum(x) % MOD sum(x) sum x MOD x dp[n] dp n MOD l = input() input() l MOD = 10**9+7 10**9+7 MOD dp = [[[0] * 2 for _ in range(3)] for _ in range(n+1)] [[[0] * 2 for _ in range(3)] for _ in range(n+1)] dp n = len(l) len(l) n
MOD = 10**9+7
l = input()
n = len(l)
dp = [[[0] * 2 for _ in range(3)] for _ in range(n+1)]
dp[0][0][1] = 1

for i in range(n):
    for j in range(3):
        dp[i][j][0] %= MOD
        dp[i][j][1] %= MOD
        dp[i+1][0][0] += dp[i][j][0]
        dp[i+1][1][0] += dp[i][j][0]
        dp[i+1][2][0] += dp[i][j][0]
        if l[i] == "1":
            dp[i+1][1][1] += dp[i][j][1]
            dp[i+1][2][1] += dp[i][j][1]
            dp[i+1][0][0] += dp[i][j][1]
        else:
            dp[i+1][0][1] += dp[i][j][1]

print(sum(map(lambda x: sum(x) % MOD, dp[n])) % MOD) 
