def mempow(a,b,m):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % m
        yield temp

L = open(0).read().split()[0]
m = 1000000007
mem2 = []
mem3 = []
m2append = mem2.append
m3append = mem3.append
for x in mempow(2,L.count('1'),m):
    m2append(x)
for x in mempow(3,len(L)-1,m):
    m3append(x)
ans = mem3[len(L)-1]
appeared = 1
for i in range(1,len(L)):
    if L[i] == '1':
        ans = (ans+mem2[appeared]*mem3[len(L)-i-1]) % m
        appeared += 1
ans = (ans+mem2[appeared]) % m
print(ans) def mempow(a,b,m):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % m
        yield temp mempow temp = 1 temp 1 yield temp temp for i in range(b):
        temp = temp * a % m
        yield temp i range(b) range b temp = temp * a % m temp temp * a % m temp * a temp a m yield temp temp a a b b m m L = open(0).read().split()[0] L open(0).read().split()[0] (0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split 0 m = 1000000007 m 1000000007 mem2 = [] mem2 [] mem3 = [] mem3 [] m2append = mem2.append m2append mem2.append mem2 append m3append = mem3.append m3append mem3.append mem3 append for x in mempow(2,L.count('1'),m):
    m2append(x) x mempow(2,L.count('1'),m) mempow 2 L.count('1') L.count L count '1' m m2append(x) m2append x for x in mempow(3,len(L)-1,m):
    m3append(x) x mempow(3,len(L)-1,m) mempow 3 len(L)-1 len(L) len L 1 m m3append(x) m3append x ans = mem3[len(L)-1] ans mem3[len(L)-1] mem3 len(L)-1 len(L) len L 1 appeared = 1 appeared 1 for i in range(1,len(L)):
    if L[i] == '1':
        ans = (ans+mem2[appeared]*mem3[len(L)-i-1]) % m
        appeared += 1 i range(1,len(L)) range 1 len(L) len L if L[i] == '1':
        ans = (ans+mem2[appeared]*mem3[len(L)-i-1]) % m
        appeared += 1 L[i] == '1' L[i] L i '1' ans = (ans+mem2[appeared]*mem3[len(L)-i-1]) % m ans (ans+mem2[appeared]*mem3[len(L)-i-1]) % m ans+mem2[appeared]*mem3[len(L)-i-1] ans mem2[appeared]*mem3[len(L)-i-1] mem2[appeared] mem2 appeared mem3[len(L)-i-1] mem3 len(L)-i-1 len(L)-i len(L) len L i 1 m appeared += 1 appeared 1 ans = (ans+mem2[appeared]) % m ans (ans+mem2[appeared]) % m ans+mem2[appeared] ans mem2[appeared] mem2 appeared m print(ans) print ans m = 1000000007 1000000007 m m3append = mem3.append mem3.append m3append def mempow(a,b,m):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % m
        yield temp def mempow(a,b,m):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % m
        yield temp mempow L = open(0).read().split()[0] open(0).read().split()[0] L appeared += 1 1 appeared mem3 = [] [] mem3 ans = (ans+mem2[appeared]) % m (ans+mem2[appeared]) % m ans ans = mem3[len(L)-1] mem3[len(L)-1] ans mem2 = [] [] mem2 ans = (ans+mem2[appeared]*mem3[len(L)-i-1]) % m (ans+mem2[appeared]*mem3[len(L)-i-1]) % m ans m2append = mem2.append mem2.append m2append appeared = 1 1 appeared
def mempow(a,b,m):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % m
        yield temp

L = open(0).read().split()[0]
m = 1000000007
mem2 = []
mem3 = []
m2append = mem2.append
m3append = mem3.append
for x in mempow(2,L.count('1'),m):
    m2append(x)
for x in mempow(3,len(L)-1,m):
    m3append(x)
ans = mem3[len(L)-1]
appeared = 1
for i in range(1,len(L)):
    if L[i] == '1':
        ans = (ans+mem2[appeared]*mem3[len(L)-i-1]) % m
        appeared += 1
ans = (ans+mem2[appeared]) % m
print(ans)