import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from itertools import product
def resolve():
    L=input()
    dp=[0]*2
    dp[0]=1
    for l in L:
        l=int(l)
        ndp=[0]*2
        for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
        dp=ndp
    print(sum(dp)%MOD)
resolve() import sys sys sys.setrecursionlimit(2147483647) sys.setrecursionlimit sys setrecursionlimit 2147483647 INF=float("inf") INF float("inf") float "inf" MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 input=lambda:sys.stdin.readline().rstrip() input lambda:sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip from itertools import product def resolve():
    L=input()
    dp=[0]*2
    dp[0]=1
    for l in L:
        l=int(l)
        ndp=[0]*2
        for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
        dp=ndp
    print(sum(dp)%MOD) resolve L=input() L input() input dp=[0]*2 dp [0]*2 [0] 0 2 dp[0]=1 dp[0] dp 0 1 for l in L:
        l=int(l)
        ndp=[0]*2
        for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
        dp=ndp
     l L l=int(l) l int(l) int l ndp=[0]*2 ndp [0]*2 [0] 0 2 for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
         a b lt product(range(2),repeat=3) product range(2) range 2 repeat=3 repeat 3 if(a*b): continue
             a*b a b if((not lt) and (a+b>l)): continue
             (not lt) and (a+b>l) not lt lt a+b>l a+b a b l ndp[max(lt,a+b<l)]+=dp[lt] ndp[max(lt,a+b<l)] ndp max(lt,a+b<l) max lt a+b<l a+b a b l dp[lt] dp lt ndp[max(lt,a+b<l)]%=MOD ndp[max(lt,a+b<l)] ndp max(lt,a+b<l) max lt a+b<l a+b a b l MOD dp=ndp dp ndp print(sum(dp)%MOD) print sum(dp)%MOD sum(dp) sum dp MOD resolve() resolve def resolve():
    L=input()
    dp=[0]*2
    dp[0]=1
    for l in L:
        l=int(l)
        ndp=[0]*2
        for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
        dp=ndp
    print(sum(dp)%MOD) def resolve():
    L=input()
    dp=[0]*2
    dp[0]=1
    for l in L:
        l=int(l)
        ndp=[0]*2
        for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
        dp=ndp
    print(sum(dp)%MOD) resolve INF=float("inf") float("inf") INF MOD=10**9+7 10**9+7 MOD input=lambda:sys.stdin.readline().rstrip() lambda:sys.stdin.readline().rstrip() input
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from itertools import product
def resolve():
    L=input()
    dp=[0]*2
    dp[0]=1
    for l in L:
        l=int(l)
        ndp=[0]*2
        for a,b,lt in product(range(2),repeat=3):
            if(a*b): continue
            if((not lt) and (a+b>l)): continue
            ndp[max(lt,a+b<l)]+=dp[lt]
            ndp[max(lt,a+b<l)]%=MOD
        dp=ndp
    print(sum(dp)%MOD)
resolve()