#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using ll=long long; #define int ll #define rng(i,a,b) for(int i=int(a);i=int(a);i--) #define per(i,b) gnr(i,0,b) #define eb emplace_back #define all(x) x.begin(),x.end() #define SZ(x) ((int)x.size()) #define fi first #define se second const int INF = 1e15; using namespace std; template using vc=vector; template using vvc=vc>; using pi=pair; using vi=vc; template inline bool chmax(T &a,T b){if(a inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;} const int mod = 1e9+7; int dp[100010][10]; signed main() { cin.tie(0); ios::sync_with_stdio(0); cout<> T; int D; cin >> D; int pos; dp[0][0]=1; rep(i,SZ(T)) { if(T[i]=='?') { rep(j,10) { rep(k,10) { if(j+k>=10){ pos=(j+k)%10+1; } else { pos=j+k; } dp[i+1][pos] += dp[i][j]; dp[i+1][pos] %= mod; } } } else { rep(j,10) { pos = j+(T[i]-'0'); if(pos>=10) pos=pos%10+1; dp[i+1][pos] += dp[i][j]; dp[i+1][pos] %= mod; } } } cout << dp[SZ(T)][D] << endl; }