mod = 10 ** 9 + 7

S = input()
N = len(S)

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

for i in range(N):
    nd = int(S[i])
    for k in range(2):
        for a in range(2):
            for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod

ans = (dp[N][0] + dp[N][1]) % mod
print(ans) mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 S = input() S input() input N = len(S) N len(S) len S [0] * 2 for _ in range(N + 10) for _ in range(N + 10) _ range(N + 10) range N + 10 N 10 for _ in range(N + 10) [0] * 2 [0] 0 2 dp = [[0] * 2 for _ in range(N + 10)] dp [[0] * 2 for _ in range(N + 10)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(N):
    nd = int(S[i])
    for k in range(2):
        for a in range(2):
            for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod i range(N) range N nd = int(S[i]) nd int(S[i]) int S[i] S i for k in range(2):
        for a in range(2):
            for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod k range(2) range 2 for a in range(2):
            for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod a range(2) range 2 for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod b range(2) range 2 ni = i + 1 ni i + 1 i 1 nk = k nk k if a == b == 1:
                    continue
                 a == b == 1 a == b a b 1 continue if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                 nk == 0 nk 0 if nd == 1 and a + b == 0:
                        nk += 1
                     nd == 1 and a + b == 0 nd == 1 nd 1 a + b == 0 a + b a b 0 nk += 1 nk 1 if nd == 0 and a + b == 1:
                        continue
                 nd == 0 and a + b == 1 nd == 0 nd 0 a + b == 1 a + b a b 1 continue dp[ni][nk] += dp[i][k] dp[ni][nk] [ni] dp ni nk dp[i][k] [i] dp i k dp[ni][nk] %= mod dp[ni][nk] [ni] dp ni nk mod ans = (dp[N][0] + dp[N][1]) % mod ans (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 print(ans) print ans nk += 1 1 nk N = len(S) len(S) N dp = [[0] * 2 for _ in range(N + 10)] [[0] * 2 for _ in range(N + 10)] dp ans = (dp[N][0] + dp[N][1]) % mod (dp[N][0] + dp[N][1]) % mod ans ni = i + 1 i + 1 ni S = input() input() S nd = int(S[i]) int(S[i]) nd mod = 10 ** 9 + 7 10 ** 9 + 7 mod nk = k k nk
mod = 10 ** 9 + 7

S = input()
N = len(S)

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

for i in range(N):
    nd = int(S[i])
    for k in range(2):
        for a in range(2):
            for b in range(2):
                ni = i + 1
                nk = k
                if a == b == 1:
                    continue
                if nk == 0:
                    if nd == 1 and a + b == 0:
                        nk += 1
                    if nd == 0 and a + b == 1:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod

ans = (dp[N][0] + dp[N][1]) % mod
print(ans)