#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
char c[15000007];
int a[15000007],dp[15000007],to[15000007];
int tong[15000007];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n=0;
string s;
cin>>s;n=s.size();
for(int i=1;i<=n;i++){
a[i]=s[i-1]-'0';
}
int l=1;to[1]=1;
for(int i=2;i<=n;i++){
int sum=0,now=a[i];
for(int j=i-1;j>=l;j--){
now+=a[j];
if(tong[now]++) sum++;
}
while(sum){
now=a[l];
for(int j=l+1;j<=i;j++){
now+=a[j];
if(--tong[now]) sum--;
}
l++;
}
to[i]=l;
}
dp[0]=1;
for(int i=1;i<=n;i++){
for(int j=i;j>=to[i];j--){
dp[i]=dp[i]+dp[j-1];
dp[i]=(dp[i]>mod?dp[i]-mod:dp[i]);
}
}
cout<<dp[n]%mod;
return 0;
}