l = input()
p = 10 ** 9 + 7
dp = [0, 1]
for i in l:
    dp2 = [j % p for j in dp]
    if i == "0":
        dp[0] = dp2[0] * 3
        dp[1] = dp2[1]
    else:
        dp[0] = dp2[0] * 3 + dp2[1]
        dp[1] = dp2[1] * 2
print(sum(dp) % p) l = input() l input() input p = 10 ** 9 + 7 p 10 ** 9 + 7 10 ** 9 10 9 7 dp = [0, 1] dp [0, 1] 0 1 for i in l:
    dp2 = [j % p for j in dp]
    if i == "0":
        dp[0] = dp2[0] * 3
        dp[1] = dp2[1]
    else:
        dp[0] = dp2[0] * 3 + dp2[1]
        dp[1] = dp2[1] * 2 i l j % p for j in dp for j in dp j dp for j in dp j % p j p dp2 = [j % p for j in dp] dp2 [j % p for j in dp] if i == "0":
        dp[0] = dp2[0] * 3
        dp[1] = dp2[1]
    else:
        dp[0] = dp2[0] * 3 + dp2[1]
        dp[1] = dp2[1] * 2 i == "0" i "0" dp[0] = dp2[0] * 3 dp[0] dp 0 dp2[0] * 3 dp2[0] dp2 0 3 dp[1] = dp2[1] dp[1] dp 1 dp2[1] dp2 1 dp[0] = dp2[0] * 3 + dp2[1] dp[0] dp 0 dp2[0] * 3 + dp2[1] dp2[0] * 3 dp2[0] dp2 0 3 dp2[1] dp2 1 dp[1] = dp2[1] * 2 dp[1] dp 1 dp2[1] * 2 dp2[1] dp2 1 2 print(sum(dp) % p) print sum(dp) % p sum(dp) sum dp p dp = [0, 1] [0, 1] dp l = input() input() l dp2 = [j % p for j in dp] [j % p for j in dp] dp2 p = 10 ** 9 + 7 10 ** 9 + 7 p
l = input()
p = 10 ** 9 + 7
dp = [0, 1]
for i in l:
    dp2 = [j % p for j in dp]
    if i == "0":
        dp[0] = dp2[0] * 3
        dp[1] = dp2[1]
    else:
        dp[0] = dp2[0] * 3 + dp2[1]
        dp[1] = dp2[1] * 2
print(sum(dp) % p)
