MOD = 10**9 + 7

strL = input().rstrip()

maxD = len(strL)

dp = [[0]*(2) for _ in range(maxD+1)]
dp[0][0] = 1
for d, Ld in enumerate(strL):
    Ld = int(Ld)
    for isLT in range(2):
        dp[d][isLT] %= MOD
        for a, b in [(0, 0), (0, 1), (1, 0)]:
            if not isLT and a+b > Ld: continue
            isLT2 = isLT or a+b < Ld
            dp[d+1][isLT2] += dp[d][isLT]

ans = (dp[-1][0] + dp[-1][1]) % MOD
print(ans) MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 strL = input().rstrip() strL input().rstrip() ().rstrip () input rstrip maxD = len(strL) maxD len(strL) len strL [0]*(2) for _ in range(maxD+1) for _ in range(maxD+1) _ range(maxD+1) range maxD+1 maxD 1 for _ in range(maxD+1) [0]*(2) [0] 0 2 dp = [[0]*(2) for _ in range(maxD+1)] dp [[0]*(2) for _ in range(maxD+1)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for d, Ld in enumerate(strL):
    Ld = int(Ld)
    for isLT in range(2):
        dp[d][isLT] %= MOD
        for a, b in [(0, 0), (0, 1), (1, 0)]:
            if not isLT and a+b > Ld: continue
            isLT2 = isLT or a+b < Ld
            dp[d+1][isLT2] += dp[d][isLT] d Ld enumerate(strL) enumerate strL Ld = int(Ld) Ld int(Ld) int Ld for isLT in range(2):
        dp[d][isLT] %= MOD
        for a, b in [(0, 0), (0, 1), (1, 0)]:
            if not isLT and a+b > Ld: continue
            isLT2 = isLT or a+b < Ld
            dp[d+1][isLT2] += dp[d][isLT] isLT range(2) range 2 dp[d][isLT] %= MOD dp[d][isLT] [d] dp d isLT MOD for a, b in [(0, 0), (0, 1), (1, 0)]:
            if not isLT and a+b > Ld: continue
            isLT2 = isLT or a+b < Ld
            dp[d+1][isLT2] += dp[d][isLT] a b [(0, 0), (0, 1), (1, 0)] (0, 0) 0 0 (0, 1) 0 1 (1, 0) 1 0 if not isLT and a+b > Ld: continue
             not isLT and a+b > Ld not isLT isLT a+b > Ld a+b a b Ld isLT2 = isLT or a+b < Ld isLT2 isLT or a+b < Ld isLT a+b < Ld a+b a b Ld dp[d+1][isLT2] += dp[d][isLT] dp[d+1][isLT2] [d+1] dp d+1 d 1 isLT2 dp[d][isLT] [d] dp d isLT ans = (dp[-1][0] + dp[-1][1]) % MOD ans (dp[-1][0] + dp[-1][1]) % MOD dp[-1][0] + dp[-1][1] dp[-1][0] [-1] dp -1 0 dp[-1][1] [-1] dp -1 1 MOD print(ans) print ans isLT2 = isLT or a+b < Ld isLT or a+b < Ld isLT2 dp = [[0]*(2) for _ in range(maxD+1)] [[0]*(2) for _ in range(maxD+1)] dp MOD = 10**9 + 7 10**9 + 7 MOD strL = input().rstrip() input().rstrip() strL maxD = len(strL) len(strL) maxD Ld = int(Ld) int(Ld) Ld ans = (dp[-1][0] + dp[-1][1]) % MOD (dp[-1][0] + dp[-1][1]) % MOD ans
MOD = 10**9 + 7

strL = input().rstrip()

maxD = len(strL)

dp = [[0]*(2) for _ in range(maxD+1)]
dp[0][0] = 1
for d, Ld in enumerate(strL):
    Ld = int(Ld)
    for isLT in range(2):
        dp[d][isLT] %= MOD
        for a, b in [(0, 0), (0, 1), (1, 0)]:
            if not isLT and a+b > Ld: continue
            isLT2 = isLT or a+b < Ld
            dp[d+1][isLT2] += dp[d][isLT]

ans = (dp[-1][0] + dp[-1][1]) % MOD
print(ans)
