#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 1e9+7;
char s[100005];
int main(){
// freopen("2019in.txt","r",stdin);
// freopen("2019out.txt","w",stdout);
while(~scanf("%s",&s)){
LL a=0, b=0, c=0, ans=0;
int n = strlen(s);
// printf("%d ",n);
for(int i=0; i<n; i++){
if(s[i] == '2'){
a++;//记录2
a %= mod;
}
else if(s[i] == '0'){
b += a;//记录20
b %= mod;
}
else if(s[i] == '1'){
c += b;//记录201
c %= mod;
}
else{
ans += c;//记录2019
ans %= mod;
}
}
printf("%lld\n",ans);
}
}