import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし


L = LI2()
N = len(L)
mod = 10**9+7

a = 1
b = 0

for i in range(N):
    if L[i] == 1:
        b += pow(3,N-i-1,mod)*a
        b %= mod
        a *= 2
        a %= mod

print((a+b) % mod) import sys sys def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし LI2 L = LI2() L LI2() LI2 N = len(L) N len(L) len L mod = 10**9+7 mod 10**9+7 10**9 10 9 7 a = 1 a 1 b = 0 b 0 for i in range(N):
    if L[i] == 1:
        b += pow(3,N-i-1,mod)*a
        b %= mod
        a *= 2
        a %= mod i range(N) range N if L[i] == 1:
        b += pow(3,N-i-1,mod)*a
        b %= mod
        a *= 2
        a %= mod L[i] == 1 L[i] L i 1 b += pow(3,N-i-1,mod)*a b pow(3,N-i-1,mod)*a pow(3,N-i-1,mod) pow 3 N-i-1 N-i N i 1 mod a b %= mod b mod a *= 2 a 2 a %= mod a mod print((a+b) % mod) print (a+b) % mod a+b a b mod mod = 10**9+7 10**9+7 mod b = 0 0 b def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし LI2 b += pow(3,N-i-1,mod)*a pow(3,N-i-1,mod)*a b L = LI2() LI2() L N = len(L) len(L) N a *= 2 2 a a = 1 1 a a %= mod mod a b %= mod mod b
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし


L = LI2()
N = len(L)
mod = 10**9+7

a = 1
b = 0

for i in range(N):
    if L[i] == 1:
        b += pow(3,N-i-1,mod)*a
        b %= mod
        a *= 2
        a %= mod

print((a+b) % mod)
