l = input()
n = len(l)
mod = 10 ** 9 + 7
dp = [[0 for i in range(2)] for j in range(n + 1)]
dp[0][1] = 1
for i in range(n):
    if l[i] == "1":
        dp[i + 1][0] = dp[i][0] * 3 + dp[i][1]
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1] * 2
        dp[i + 1][1] %= mod
    else:
        dp[i + 1][0] = dp[i][0] * 3
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1]
        dp[i + 1][1] %= mod
print((dp[n][0] + dp[n][1]) % mod) l = input() l input() input n = len(l) n len(l) len l mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 [0 for i in range(2)] for j in range(n + 1) for j in range(n + 1) j range(n + 1) range n + 1 n 1 for j in range(n + 1) [0 for i in range(2)] dp = [[0 for i in range(2)] for j in range(n + 1)] dp [[0 for i in range(2)] for j in range(n + 1)] dp[0][1] = 1 dp[0][1] [0] dp 0 1 1 for i in range(n):
    if l[i] == "1":
        dp[i + 1][0] = dp[i][0] * 3 + dp[i][1]
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1] * 2
        dp[i + 1][1] %= mod
    else:
        dp[i + 1][0] = dp[i][0] * 3
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1]
        dp[i + 1][1] %= mod i range(n) range n if l[i] == "1":
        dp[i + 1][0] = dp[i][0] * 3 + dp[i][1]
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1] * 2
        dp[i + 1][1] %= mod
    else:
        dp[i + 1][0] = dp[i][0] * 3
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1]
        dp[i + 1][1] %= mod l[i] == "1" l[i] l i "1" dp[i + 1][0] = dp[i][0] * 3 + dp[i][1] dp[i + 1][0] [i + 1] dp i + 1 i 1 0 dp[i][0] * 3 + dp[i][1] dp[i][0] * 3 dp[i][0] [i] dp i 0 3 dp[i][1] [i] dp i 1 dp[i + 1][0] %= mod dp[i + 1][0] [i + 1] dp i + 1 i 1 0 mod dp[i + 1][1] = dp[i][1] * 2 dp[i + 1][1] [i + 1] dp i + 1 i 1 1 dp[i][1] * 2 dp[i][1] [i] dp i 1 2 dp[i + 1][1] %= mod dp[i + 1][1] [i + 1] dp i + 1 i 1 1 mod dp[i + 1][0] = dp[i][0] * 3 dp[i + 1][0] [i + 1] dp i + 1 i 1 0 dp[i][0] * 3 dp[i][0] [i] dp i 0 3 dp[i + 1][0] %= mod dp[i + 1][0] [i + 1] dp i + 1 i 1 0 mod dp[i + 1][1] = dp[i][1] dp[i + 1][1] [i + 1] dp i + 1 i 1 1 dp[i][1] [i] dp i 1 dp[i + 1][1] %= mod dp[i + 1][1] [i + 1] dp i + 1 i 1 1 mod 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 dp = [[0 for i in range(2)] for j in range(n + 1)] [[0 for i in range(2)] for j in range(n + 1)] dp l = input() input() l mod = 10 ** 9 + 7 10 ** 9 + 7 mod n = len(l) len(l) n
l = input()
n = len(l)
mod = 10 ** 9 + 7
dp = [[0 for i in range(2)] for j in range(n + 1)]
dp[0][1] = 1
for i in range(n):
    if l[i] == "1":
        dp[i + 1][0] = dp[i][0] * 3 + dp[i][1]
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1] * 2
        dp[i + 1][1] %= mod
    else:
        dp[i + 1][0] = dp[i][0] * 3
        dp[i + 1][0] %= mod
        dp[i + 1][1] = dp[i][1]
        dp[i + 1][1] %= mod
print((dp[n][0] + dp[n][1]) % mod)