MOD = 10 ** 9 + 7
L = input()
N = len(L)

dp = [[0] * 2 for _ in range(N + 1)]
dp[0][0] = 1

for i in range(N):
    d = int(L[i])
    for j in range(2):
        D = 1 if (d == 1 or j == 1) else 0
        for a, b in [(1, 0), (0, 1), (0, 0)]:
            if a + b <= D:
                here = dp[i + 1][j | (a + b < D)]
                here = (here + dp[i][j]) % MOD
                dp[i + 1][j | (a + b < D)] = here

print((dp[N][0] + dp[N][1]) % 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(N + 1) for _ in range(N + 1) _ range(N + 1) range N + 1 N 1 for _ in range(N + 1) [0] * 2 [0] 0 2 dp = [[0] * 2 for _ in range(N + 1)] dp [[0] * 2 for _ in range(N + 1)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(N):
    d = int(L[i])
    for j in range(2):
        D = 1 if (d == 1 or j == 1) else 0
        for a, b in [(1, 0), (0, 1), (0, 0)]:
            if a + b <= D:
                here = dp[i + 1][j | (a + b < D)]
                here = (here + dp[i][j]) % MOD
                dp[i + 1][j | (a + b < D)] = here i range(N) range N d = int(L[i]) d int(L[i]) int L[i] L i for j in range(2):
        D = 1 if (d == 1 or j == 1) else 0
        for a, b in [(1, 0), (0, 1), (0, 0)]:
            if a + b <= D:
                here = dp[i + 1][j | (a + b < D)]
                here = (here + dp[i][j]) % MOD
                dp[i + 1][j | (a + b < D)] = here j range(2) range 2 D = 1 if (d == 1 or j == 1) else 0 D 1 if (d == 1 or j == 1) else 0 d == 1 or j == 1 d == 1 d 1 j == 1 j 1 1 0 for a, b in [(1, 0), (0, 1), (0, 0)]:
            if a + b <= D:
                here = dp[i + 1][j | (a + b < D)]
                here = (here + dp[i][j]) % MOD
                dp[i + 1][j | (a + b < D)] = here a b [(1, 0), (0, 1), (0, 0)] (1, 0) 1 0 (0, 1) 0 1 (0, 0) 0 0 if a + b <= D:
                here = dp[i + 1][j | (a + b < D)]
                here = (here + dp[i][j]) % MOD
                dp[i + 1][j | (a + b < D)] = here a + b <= D a + b a b D here = dp[i + 1][j | (a + b < D)] here dp[i + 1][j | (a + b < D)] [i + 1] dp i + 1 i 1 j | (a + b < D) j a + b < D a + b a b D here = (here + dp[i][j]) % MOD here (here + dp[i][j]) % MOD here + dp[i][j] here dp[i][j] [i] dp i j MOD dp[i + 1][j | (a + b < D)] = here dp[i + 1][j | (a + b < D)] [i + 1] dp i + 1 i 1 j | (a + b < D) j a + b < D a + b a b D here print((dp[N][0] + dp[N][1]) % MOD) print (dp[N][0] + dp[N][1]) % MOD dp[N][0] + dp[N][1] dp[N][0] [N] dp N 0 dp[N][1] [N] dp N 1 MOD N = len(L) len(L) N here = dp[i + 1][j | (a + b < D)] dp[i + 1][j | (a + b < D)] here MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD dp = [[0] * 2 for _ in range(N + 1)] [[0] * 2 for _ in range(N + 1)] dp L = input() input() L d = int(L[i]) int(L[i]) d D = 1 if (d == 1 or j == 1) else 0 1 if (d == 1 or j == 1) else 0 D here = (here + dp[i][j]) % MOD (here + dp[i][j]) % MOD here
MOD = 10 ** 9 + 7
L = input()
N = len(L)

dp = [[0] * 2 for _ in range(N + 1)]
dp[0][0] = 1

for i in range(N):
    d = int(L[i])
    for j in range(2):
        D = 1 if (d == 1 or j == 1) else 0
        for a, b in [(1, 0), (0, 1), (0, 0)]:
            if a + b <= D:
                here = dp[i + 1][j | (a + b < D)]
                here = (here + dp[i][j]) % MOD
                dp[i + 1][j | (a + b < D)] = here

print((dp[N][0] + dp[N][1]) % MOD)
