L = input()

m = 1000000007

result = 1
t = 1
for c in L[::-1]:
    if c == '1':
        result = result * 2 + t
        result %= m
    t *= 3
    t %= m
print(result) L = input() L input() input m = 1000000007 m 1000000007 result = 1 result 1 t = 1 t 1 for c in L[::-1]:
    if c == '1':
        result = result * 2 + t
        result %= m
    t *= 3
    t %= m c L[::-1] L ::-1 -1 if c == '1':
        result = result * 2 + t
        result %= m
     c == '1' c '1' result = result * 2 + t result result * 2 + t result * 2 result 2 t result %= m result m t *= 3 t 3 t %= m t m print(result) print result L = input() input() L result = result * 2 + t result * 2 + t result t *= 3 3 t result = 1 1 result t = 1 1 t result %= m m result t %= m m t m = 1000000007 1000000007 m
L = input()

m = 1000000007

result = 1
t = 1
for c in L[::-1]:
    if c == '1':
        result = result * 2 + t
        result %= m
    t *= 3
    t %= m
print(result)
