import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    L = S()
    dp = [[0 for _ in range(2)] for ___ in range(len(L) + 1)]
    dp[0][0] = 1

    for i in range(len(L)):
        # place 0
        dp[i+1][1] += dp[i][1] * 2
        if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

        # place 1
        dp[i+1][1] += dp[i][1]
        if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

    ans = dp[len(L)][0] + dp[len(L)][1]
    ans %= mod
    print(ans)
main() import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools math string itertools fractions heapq collections re array bisect sys random time copy functools from collections import deque sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 inf = 10**20 inf 10**20 10 20 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 DR = [1, -1, 0, 0] DR [1, -1, 0, 0] 1 -1 0 0 DC = [0, 0, 1, -1] DC [0, 0, 1, -1] 0 0 1 -1 int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI int(x)-1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ float(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) F def S(): return input()
      S def main():
    L = S()
    dp = [[0 for _ in range(2)] for ___ in range(len(L) + 1)]
    dp[0][0] = 1

    for i in range(len(L)):
        # place 0
        dp[i+1][1] += dp[i][1] * 2
        if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

        # place 1
        dp[i+1][1] += dp[i][1]
        if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

    ans = dp[len(L)][0] + dp[len(L)][1]
    ans %= mod
    print(ans) main L = S() L S() S [0 for _ in range(2)] for ___ in range(len(L) + 1) for ___ in range(len(L) + 1) ___ range(len(L) + 1) range len(L) + 1 len(L) len L 1 for ___ in range(len(L) + 1) [0 for _ in range(2)] dp = [[0 for _ in range(2)] for ___ in range(len(L) + 1)] dp [[0 for _ in range(2)] for ___ in range(len(L) + 1)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(len(L)):
        # place 0
        dp[i+1][1] += dp[i][1] * 2
        if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

        # place 1
        dp[i+1][1] += dp[i][1]
        if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

     i range(len(L)) range len(L) len L dp[i+1][1] += dp[i][1] * 2 dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][1] * 2 dp[i][1] [i] dp i 1 2 if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

         int(L[i]) == 1 int(L[i]) int L[i] L i 1 dp[i+1][0] += 2 * dp[i][0] dp[i+1][0] [i+1] dp i+1 i 1 0 2 * dp[i][0] 2 dp[i][0] [i] dp i 0 dp[i+1][1] += dp[i][0] dp[i+1][1] [i+1] dp i+1 i 1 1 dp[i][0] [i] dp i 0 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 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 if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

         int(L[i]) == 0 int(L[i]) int 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][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] ans 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 ans %= mod ans mod print(ans) print ans main() main DR = [1, -1, 0, 0] [1, -1, 0, 0] DR def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS DC = [0, 0, 1, -1] [0, 0, 1, -1] DC def F(): return float(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) F def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI inf = 10**20 10**20 inf def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ def main():
    L = S()
    dp = [[0 for _ in range(2)] for ___ in range(len(L) + 1)]
    dp[0][0] = 1

    for i in range(len(L)):
        # place 0
        dp[i+1][1] += dp[i][1] * 2
        if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

        # place 1
        dp[i+1][1] += dp[i][1]
        if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

    ans = dp[len(L)][0] + dp[len(L)][1]
    ans %= mod
    print(ans) def main():
    L = S()
    dp = [[0 for _ in range(2)] for ___ in range(len(L) + 1)]
    dp[0][0] = 1

    for i in range(len(L)):
        # place 0
        dp[i+1][1] += dp[i][1] * 2
        if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

        # place 1
        dp[i+1][1] += dp[i][1]
        if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

    ans = dp[len(L)][0] + dp[len(L)][1]
    ans %= mod
    print(ans) main mod = 10**9 + 7 10**9 + 7 mod def S(): return input()
      def S(): return input()
      S
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    L = S()
    dp = [[0 for _ in range(2)] for ___ in range(len(L) + 1)]
    dp[0][0] = 1

    for i in range(len(L)):
        # place 0
        dp[i+1][1] += dp[i][1] * 2
        if int(L[i]) == 1:
            dp[i+1][0] += 2 * dp[i][0]
            dp[i+1][1] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

        # place 1
        dp[i+1][1] += dp[i][1]
        if int(L[i]) == 0:
            dp[i+1][0] += dp[i][0]

        dp[i+1][0] %= mod
        dp[i+1][1] %= mod

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