import sys
input = sys.stdin.readline
L = list(map(int, list(input())[: -1]))
L.reverse()
mod = 10 ** 9 + 7
res = 1
for i in range(len(L)):
  if L[i]: res = (2 * res + pow(3, i, mod)) % mod
print(res) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline L = list(map(int, list(input())[: -1])) L list(map(int, list(input())[: -1])) list map(int, list(input())[: -1]) map int list(input())[: -1] (input()) list input() input : -1 -1 L.reverse() L.reverse L reverse mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 res = 1 res 1 for i in range(len(L)):
  if L[i]: res = (2 * res + pow(3, i, mod)) % mod i range(len(L)) range len(L) len L if L[i]: res = (2 * res + pow(3, i, mod)) % m L[i] L i print(res) print res input = sys.stdin.readline sys.stdin.readline input mod = 10 ** 9 + 7 10 ** 9 + 7 mod L = list(map(int, list(input())[: -1])) list(map(int, list(input())[: -1])) L res = 1 1 res
import sys
input = sys.stdin.readline
L = list(map(int, list(input())[: -1]))
L.reverse()
mod = 10 ** 9 + 7
res = 1
for i in range(len(L)):
  if L[i]: res = (2 * res + pow(3, i, mod)) % mod
print(res)