import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

def main():
    L = input()
    l = len(L)
    """
    LについてbitDP、かつa, bは同じ桁に1, 1とならない
    """
    stoic = 2
    affordable = 1
    for i in range(1, l):
        if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

    print((stoic + affordable) % mod)







if __name__ == "__main__":
    main() import sys sys def input(): return sys.stdin.readline().strip() input mod = 10**9+7 mod 10**9+7 10**9 10 9 7 def main():
    L = input()
    l = len(L)
    """
    LについてbitDP、かつa, bは同じ桁に1, 1とならない
    """
    stoic = 2
    affordable = 1
    for i in range(1, l):
        if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

    print((stoic + affordable) % mod) main L = input() L input() input l = len(L) l len(L) len L """
    LについてbitDP、かつa, bは同じ桁に1, 1とならない
    """ stoic = 2 stoic 2 affordable = 1 affordable 1 for i in range(1, l):
        if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

     i range(1, l) range 1 l if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

     L[i] == '1' L[i] L i '1' affordable = (stoic + affordable * 3) % mod affordable (stoic + affordable * 3) % mod stoic + affordable * 3 stoic affordable * 3 affordable 3 mod stoic = (stoic * 2) % mod stoic (stoic * 2) % mod stoic * 2 stoic 2 mod affordable = (affordable * 3) % mod affordable (affordable * 3) % mod affordable * 3 affordable 3 mod print((stoic + affordable) % mod) print (stoic + affordable) % mod stoic + affordable stoic affordable mod if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main mod = 10**9+7 10**9+7 mod def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def main():
    L = input()
    l = len(L)
    """
    LについてbitDP、かつa, bは同じ桁に1, 1とならない
    """
    stoic = 2
    affordable = 1
    for i in range(1, l):
        if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

    print((stoic + affordable) % mod) def main():
    L = input()
    l = len(L)
    """
    LについてbitDP、かつa, bは同じ桁に1, 1とならない
    """
    stoic = 2
    affordable = 1
    for i in range(1, l):
        if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

    print((stoic + affordable) % mod) main
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

def main():
    L = input()
    l = len(L)
    """
    LについてbitDP、かつa, bは同じ桁に1, 1とならない
    """
    stoic = 2
    affordable = 1
    for i in range(1, l):
        if L[i] == '1':
            affordable = (stoic + affordable * 3) % mod
            stoic = (stoic * 2) % mod
        else:
            affordable = (affordable * 3) % mod

    print((stoic + affordable) % mod)







if __name__ == "__main__":
    main()
