l = input()[::-1]

mod = 10 ** 9 + 7

pows = [1]
for i in range(10 ** 5 + 10):
    pows.append((pows[-1] * 3) % mod)

dp = 1
for i in range(len(l)):
    if l[i] == '1':
        dp = (pows[i] + dp * 2) % mod
print(dp) l = input()[::-1] l input()[::-1] () input ::-1 -1 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 pows = [1] pows [1] 1 for i in range(10 ** 5 + 10):
    pows.append((pows[-1] * 3) % mod) i range(10 ** 5 + 10) range 10 ** 5 + 10 10 ** 5 10 5 10 pows.append((pows[-1] * 3) % mod) pows.append pows append (pows[-1] * 3) % mod pows[-1] * 3 pows[-1] pows -1 3 mod dp = 1 dp 1 for i in range(len(l)):
    if l[i] == '1':
        dp = (pows[i] + dp * 2) % mod i range(len(l)) range len(l) len l if l[i] == '1':
        dp = (pows[i] + dp * 2) % mod l[i] == '1' l[i] l i '1' dp = (pows[i] + dp * 2) % mod dp (pows[i] + dp * 2) % mod pows[i] + dp * 2 pows[i] pows i dp * 2 dp 2 mod print(dp) print dp dp = 1 1 dp dp = (pows[i] + dp * 2) % mod (pows[i] + dp * 2) % mod dp l = input()[::-1] input()[::-1] l pows = [1] [1] pows mod = 10 ** 9 + 7 10 ** 9 + 7 mod
l = input()[::-1]

mod = 10 ** 9 + 7

pows = [1]
for i in range(10 ** 5 + 10):
    pows.append((pows[-1] * 3) % mod)

dp = 1
for i in range(len(l)):
    if l[i] == '1':
        dp = (pows[i] + dp * 2) % mod
print(dp)
