def main():
    L = input()
    MOD = 10 ** 9 + 7
    dp = [[0] * 2 for _ in range(10 ** 6 + 5)]
    dp[0][0] = 1
    for i in range(len(L)):
        # a + b = 0
        if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
        if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

    ans = (dp[len(L)][0] + dp[len(L)][1]) % MOD
    print(ans)
    

if __name__ == "__main__":
    main() def main():
    L = input()
    MOD = 10 ** 9 + 7
    dp = [[0] * 2 for _ in range(10 ** 6 + 5)]
    dp[0][0] = 1
    for i in range(len(L)):
        # a + b = 0
        if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
        if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

    ans = (dp[len(L)][0] + dp[len(L)][1]) % MOD
    print(ans)
     main L = input() L input() input MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 [0] * 2 for _ in range(10 ** 6 + 5) for _ in range(10 ** 6 + 5) _ range(10 ** 6 + 5) range 10 ** 6 + 5 10 ** 6 10 6 5 for _ in range(10 ** 6 + 5) [0] * 2 [0] 0 2 dp = [[0] * 2 for _ in range(10 ** 6 + 5)] dp [[0] * 2 for _ in range(10 ** 6 + 5)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(len(L)):
        # a + b = 0
        if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
        if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

     i range(len(L)) range len(L) len L if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
         L[i] == '0' L[i] L i '0' dp[i+1][0] = dp[i][0] dp[i+1][0] [i+1] dp i+1 i 1 0 dp[i][0] [i] dp i 0 dp[i+1][1] = dp[i][1] dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][1] [i] dp i 1 dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD dp[i+1][1] [i+1] dp i+1 i 1 1 (dp[i][0] + dp[i][1]) % MOD dp[i][0] + dp[i][1] dp[i][0] [i] dp i 0 dp[i][1] [i] dp i 1 MOD if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

     L[i] == '0' L[i] L i '0' dp[i+1][1] += dp[i][1] * 2 % MOD dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][1] * 2 % MOD dp[i][1] * 2 dp[i][1] [i] dp i 1 2 MOD dp[i+1][1] %= MOD dp[i+1][1] [i+1] dp i+1 i 1 1 MOD dp[i+1][0] += dp[i][0] * 2 % MOD dp[i+1][0] [i+1] dp i+1 i 1 0 dp[i][0] * 2 % MOD dp[i][0] * 2 dp[i][0] [i] dp i 0 2 MOD dp[i+1][1] += dp[i][1] * 2 % MOD dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][1] * 2 % MOD dp[i][1] * 2 dp[i][1] [i] dp i 1 2 MOD dp[i+1][0] %= MOD dp[i+1][0] [i+1] dp i+1 i 1 0 MOD dp[i+1][1] %= MOD dp[i+1][1] [i+1] dp i+1 i 1 1 MOD ans = (dp[len(L)][0] + dp[len(L)][1]) % MOD ans (dp[len(L)][0] + dp[len(L)][1]) % MOD dp[len(L)][0] + dp[len(L)][1] dp[len(L)][0] [len(L)] dp len(L) len L 0 dp[len(L)][1] [len(L)] dp len(L) len L 1 MOD print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    L = input()
    MOD = 10 ** 9 + 7
    dp = [[0] * 2 for _ in range(10 ** 6 + 5)]
    dp[0][0] = 1
    for i in range(len(L)):
        # a + b = 0
        if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
        if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

    ans = (dp[len(L)][0] + dp[len(L)][1]) % MOD
    print(ans)
     def main():
    L = input()
    MOD = 10 ** 9 + 7
    dp = [[0] * 2 for _ in range(10 ** 6 + 5)]
    dp[0][0] = 1
    for i in range(len(L)):
        # a + b = 0
        if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
        if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

    ans = (dp[len(L)][0] + dp[len(L)][1]) % MOD
    print(ans)
     main
def main():
    L = input()
    MOD = 10 ** 9 + 7
    dp = [[0] * 2 for _ in range(10 ** 6 + 5)]
    dp[0][0] = 1
    for i in range(len(L)):
        # a + b = 0
        if L[i] == '0':
            dp[i+1][0] = dp[i][0]
            dp[i+1][1] = dp[i][1]
        else:
            dp[i+1][1] = (dp[i][0] + dp[i][1]) % MOD
        
        # a + b = 1
        if L[i] == '0':
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][1] %= MOD
        else:
            dp[i+1][0] += dp[i][0] * 2 % MOD
            dp[i+1][1] += dp[i][1] * 2 % MOD
            dp[i+1][0] %= MOD
            dp[i+1][1] %= MOD

    ans = (dp[len(L)][0] + dp[len(L)][1]) % MOD
    print(ans)
    

if __name__ == "__main__":
    main()