#!/usr/bin/env python3
import sys
sys.setrecursionlimit(200000)

MOD = 1000000007  # type: int

def h(L, i):
    return pow(3, len(L)-i, MOD)

def g(L, i):
    if len(L) == i:
        return 1
    if L[i] == '1':
        return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD
    return g(L, i+1)

def solve(L: str):
    return g(L, 0)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: str
    print(solve(L))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main() import sys sys sys.setrecursionlimit(200000) sys.setrecursionlimit sys setrecursionlimit 200000 MOD = 1000000007 MOD 1000000007 def h(L, i):
    return pow(3, len(L)-i, MOD) h return pow(3, len(L)-i, MOD) pow(3, len(L)-i, MOD) pow 3 len(L)-i len(L) len L i MOD L L i i def g(L, i):
    if len(L) == i:
        return 1
    if L[i] == '1':
        return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD
    return g(L, i+1) g if len(L) == i:
        return 1
     len(L) == i len(L) len L i return 1 1 if L[i] == '1':
        return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD
     L[i] == '1' L[i] L i '1' return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD (2 * g(L, i+1)) % MOD + h(L, i+1) (2 * g(L, i+1)) % MOD 2 * g(L, i+1) 2 g(L, i+1) g L i+1 i 1 MOD h(L, i+1) h L i+1 i 1 MOD return g(L, i+1) g(L, i+1) g L i+1 i 1 L L i i def solve(L: str):
    return g(L, 0)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools solve return g(L, 0) g(L, 0) g L 0 L: str L def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: str
    print(solve(L)) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens L = next(tokens) L next(tokens) next tokens print(solve(L)) print solve(L) solve L def test():
    import doctest
    doctest.testmod() test import doctest doctest doctest.testmod() doctest.testmod doctest testmod if __name__ == '__main__':
    #test()
    main() __name__ == '__main__' __name__ '__main__' main() main def solve(L: str):
    return g(L, 0)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools def solve(L: str):
    return g(L, 0)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools solve def test():
    import doctest
    doctest.testmod() def test():
    import doctest
    doctest.testmod() test MOD = 1000000007 1000000007 MOD def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: str
    print(solve(L)) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: str
    print(solve(L)) main def h(L, i):
    return pow(3, len(L)-i, MOD) def h(L, i):
    return pow(3, len(L)-i, MOD) h def g(L, i):
    if len(L) == i:
        return 1
    if L[i] == '1':
        return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD
    return g(L, i+1) def g(L, i):
    if len(L) == i:
        return 1
    if L[i] == '1':
        return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD
    return g(L, i+1) g
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(200000)

MOD = 1000000007  # type: int

def h(L, i):
    return pow(3, len(L)-i, MOD)

def g(L, i):
    if len(L) == i:
        return 1
    if L[i] == '1':
        return ((2 * g(L, i+1)) % MOD + h(L, i+1)) % MOD
    return g(L, i+1)

def solve(L: str):
    return g(L, 0)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: str
    print(solve(L))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
