l = list(map(int, input()))
mod = 10 ** 9 + 7

ln = len(l)
dp = [0] * 2
dp[1] = 1

for e in l:
    dp_new = [0] * 2
    # exact -> exact
    dp_new[1] += dp[1] * (e + 1)

    # exact -> small
    if e == 1:
        dp_new[0] += dp[1]

    # small -> small
    dp_new[0] += dp[0] * 3

    dp = dp_new
    for i in range(2):
        dp[i] %= mod

ans = sum(dp) % mod

print(ans) l = list(map(int, input())) l list(map(int, input())) list map(int, input()) map int input() input mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 ln = len(l) ln len(l) len l dp = [0] * 2 dp [0] * 2 [0] 0 2 dp[1] = 1 dp[1] dp 1 1 for e in l:
    dp_new = [0] * 2
    # exact -> exact
    dp_new[1] += dp[1] * (e + 1)

    # exact -> small
    if e == 1:
        dp_new[0] += dp[1]

    # small -> small
    dp_new[0] += dp[0] * 3

    dp = dp_new
    for i in range(2):
        dp[i] %= mod e l dp_new = [0] * 2 dp_new [0] * 2 [0] 0 2 dp_new[1] += dp[1] * (e + 1) dp_new[1] dp_new 1 dp[1] * (e + 1) dp[1] dp 1 e + 1 e 1 if e == 1:
        dp_new[0] += dp[1]

    # small -> small
     e == 1 e 1 dp_new[0] += dp[1] dp_new[0] dp_new 0 dp[1] dp 1 dp_new[0] += dp[0] * 3 dp_new[0] dp_new 0 dp[0] * 3 dp[0] dp 0 3 dp = dp_new dp dp_new for i in range(2):
        dp[i] %= mod i range(2) range 2 dp[i] %= mod dp[i] dp i mod ans = sum(dp) % mod ans sum(dp) % mod sum(dp) sum dp mod print(ans) print ans dp = [0] * 2 [0] * 2 dp l = list(map(int, input())) list(map(int, input())) l dp_new = [0] * 2 [0] * 2 dp_new ln = len(l) len(l) ln ans = sum(dp) % mod sum(dp) % mod ans mod = 10 ** 9 + 7 10 ** 9 + 7 mod dp = dp_new dp_new dp
l = list(map(int, input()))
mod = 10 ** 9 + 7

ln = len(l)
dp = [0] * 2
dp[1] = 1

for e in l:
    dp_new = [0] * 2
    # exact -> exact
    dp_new[1] += dp[1] * (e + 1)

    # exact -> small
    if e == 1:
        dp_new[0] += dp[1]

    # small -> small
    dp_new[0] += dp[0] * 3

    dp = dp_new
    for i in range(2):
        dp[i] %= mod

ans = sum(dp) % mod

print(ans)
