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

ln = len(l)
dp = [[0] * 2 for _ in range(2)]
dp[0][1] = 1

for e in l:
    dp_new = [[0] * 2 for _ in range(2)]
    for now in range(2):
        for prev in range(2):
            # same -> same
            if now == e:
                dp_new[now][1] += dp[prev][1] * (now + 1)

            # same -> small
            if now == 0 and e == 1:
                dp_new[now][0] += dp[prev][1]

            # small -> small
            dp_new[now][0] += dp[prev][0] * (now + 1)

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

ans = 0
for row in dp:
    ans += sum(row)
    ans %= 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 [0] * 2 for _ in range(2) for _ in range(2) _ range(2) range 2 for _ in range(2) [0] * 2 [0] 0 2 dp = [[0] * 2 for _ in range(2)] dp [[0] * 2 for _ in range(2)] dp[0][1] = 1 dp[0][1] [0] dp 0 1 1 for e in l:
    dp_new = [[0] * 2 for _ in range(2)]
    for now in range(2):
        for prev in range(2):
            # same -> same
            if now == e:
                dp_new[now][1] += dp[prev][1] * (now + 1)

            # same -> small
            if now == 0 and e == 1:
                dp_new[now][0] += dp[prev][1]

            # small -> small
            dp_new[now][0] += dp[prev][0] * (now + 1)

    dp = dp_new
    for i in range(2):
        for j in range(2):
            dp[i][j] %= mod e l [0] * 2 for _ in range(2) for _ in range(2) _ range(2) range 2 for _ in range(2) [0] * 2 [0] 0 2 dp_new = [[0] * 2 for _ in range(2)] dp_new [[0] * 2 for _ in range(2)] for now in range(2):
        for prev in range(2):
            # same -> same
            if now == e:
                dp_new[now][1] += dp[prev][1] * (now + 1)

            # same -> small
            if now == 0 and e == 1:
                dp_new[now][0] += dp[prev][1]

            # small -> small
            dp_new[now][0] += dp[prev][0] * (now + 1)

     now range(2) range 2 for prev in range(2):
            # same -> same
            if now == e:
                dp_new[now][1] += dp[prev][1] * (now + 1)

            # same -> small
            if now == 0 and e == 1:
                dp_new[now][0] += dp[prev][1]

            # small -> small
            dp_new[now][0] += dp[prev][0] * (now + 1)

     prev range(2) range 2 if now == e:
                dp_new[now][1] += dp[prev][1] * (now + 1)

            # same -> small
             now == e now e dp_new[now][1] += dp[prev][1] * (now + 1) dp_new[now][1] [now] dp_new now 1 dp[prev][1] * (now + 1) dp[prev][1] [prev] dp prev 1 now + 1 now 1 if now == 0 and e == 1:
                dp_new[now][0] += dp[prev][1]

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

ln = len(l)
dp = [[0] * 2 for _ in range(2)]
dp[0][1] = 1

for e in l:
    dp_new = [[0] * 2 for _ in range(2)]
    for now in range(2):
        for prev in range(2):
            # same -> same
            if now == e:
                dp_new[now][1] += dp[prev][1] * (now + 1)

            # same -> small
            if now == 0 and e == 1:
                dp_new[now][0] += dp[prev][1]

            # small -> small
            dp_new[now][0] += dp[prev][0] * (now + 1)

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

ans = 0
for row in dp:
    ans += sum(row)
    ans %= mod

print(ans)
