import sys

sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    L = input()
    n = len(L)

    res = 0
    cnt = 0
    for i in range(n):
        if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

    res += pow(2, cnt, mod)
    print(res % mod)


if __name__ == '__main__':
    resolve() import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 f_inf = float('inf') f_inf float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 def resolve():
    L = input()
    n = len(L)

    res = 0
    cnt = 0
    for i in range(n):
        if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

    res += pow(2, cnt, mod)
    print(res % mod) resolve L = input() L input() input n = len(L) n len(L) len L res = 0 res 0 cnt = 0 cnt 0 for i in range(n):
        if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

     i range(n) range n if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

     L[i] == "1" L[i] L i "1" rest = n - (i + 1) rest n - (i + 1) n i + 1 i 1 res += pow(2, cnt, mod) * pow(3, rest, mod) % mod res pow(2, cnt, mod) * pow(3, rest, mod) % mod pow(2, cnt, mod) * pow(3, rest, mod) pow(2, cnt, mod) pow 2 cnt mod pow(3, rest, mod) pow 3 rest mod mod res %= mod res mod cnt += 1 cnt 1 res += pow(2, cnt, mod) res pow(2, cnt, mod) pow 2 cnt mod print(res % mod) print res % mod res mod if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve f_inf = float('inf') float('inf') f_inf mod = 10 ** 9 + 7 10 ** 9 + 7 mod def resolve():
    L = input()
    n = len(L)

    res = 0
    cnt = 0
    for i in range(n):
        if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

    res += pow(2, cnt, mod)
    print(res % mod) def resolve():
    L = input()
    n = len(L)

    res = 0
    cnt = 0
    for i in range(n):
        if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

    res += pow(2, cnt, mod)
    print(res % mod) resolve
import sys

sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    L = input()
    n = len(L)

    res = 0
    cnt = 0
    for i in range(n):
        if L[i] == "1":
            rest = n - (i + 1)
            res += pow(2, cnt, mod) * pow(3, rest, mod) % mod
            res %= mod
            cnt += 1

    res += pow(2, cnt, mod)
    print(res % mod)


if __name__ == '__main__':
    resolve()
