from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

l = ins()
a = l[::-1]
n = len(l)
x = 3 if a[0]=='1' else 1
for i in range(1,n):
    if a[i]=='1':
        x = (2*x+pow(3,i,R))%R
print(x) from sys import stdout printn = lambda x: stdout.write(str(x)) printn lambda x: stdout.write(str(x)) stdout.write(str(x)) stdout.write stdout write str(x) str x x inn = lambda : int(input()) inn lambda : int(input()) int(input()) int input() input inl   = lambda: list(map(int, input().split())) inl lambda: list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split inm   = lambda:      map(int, input().split()) inm lambda:      map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split ins = lambda : input().strip() ins lambda : input().strip() input().strip() ().strip () input strip DBG = True DBG True BIG = 999999999 BIG 999999999 R = 10**9 + 7 R 10**9 + 7 10**9 10 9 7 def ddprint(x):
  if DBG:
    print(x) ddprint if DBG:
    print(x) DBG print(x) print x x x l = ins() l ins() ins a = l[::-1] a l[::-1] l ::-1 -1 n = len(l) n len(l) len l x = 3 if a[0]=='1' else 1 x 3 if a[0]=='1' else 1 a[0]=='1' a[0] a 0 '1' 3 1 for i in range(1,n):
    if a[i]=='1':
        x = (2*x+pow(3,i,R))%R i range(1,n) range 1 n if a[i]=='1':
        x = (2*x+pow(3,i,R))%R a[i]=='1' a[i] a i '1' x = (2*x+pow(3,i,R))%R x (2*x+pow(3,i,R))%R 2*x+pow(3,i,R) 2*x 2 x pow(3,i,R) pow 3 i R R print(x) print x l = ins() ins() l inl   = lambda: list(map(int, input().split())) lambda: list(map(int, input().split())) inl BIG = 999999999 999999999 BIG inm   = lambda:      map(int, input().split()) lambda:      map(int, input().split()) inm x = 3 if a[0]=='1' else 1 3 if a[0]=='1' else 1 x printn = lambda x: stdout.write(str(x)) lambda x: stdout.write(str(x)) printn R = 10**9 + 7 10**9 + 7 R inn = lambda : int(input()) lambda : int(input()) inn x = (2*x+pow(3,i,R))%R (2*x+pow(3,i,R))%R x def ddprint(x):
  if DBG:
    print(x) def ddprint(x):
  if DBG:
    print(x) ddprint DBG = True True DBG n = len(l) len(l) n ins = lambda : input().strip() lambda : input().strip() ins a = l[::-1] l[::-1] a
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

l = ins()
a = l[::-1]
n = len(l)
x = 3 if a[0]=='1' else 1
for i in range(1,n):
    if a[i]=='1':
        x = (2*x+pow(3,i,R))%R
print(x)
