#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b>s; int d;cin>>d; if(d==0){ bool f=true; for(auto c:s){ if(c!='0' and c!='?') f=false; } cout< dp(10,0); dp[0]=1; reverse(ALL(s)); rep(i,(int)s.size()){ vector newdp(10,0); if(s[i]=='?'){ rep(t,10){ rep(j,10){ int to=(j+t)%9; newdp[to]+=dp[j]; newdp[to]%=mod; } } }else{ int t=s[i]-'0'; for(int j=0;j<10;j++){ int to=(j+t)%9; newdp[to]+=dp[j]; newdp[to]%=mod; } } swap(dp,newdp); } ll ans; if(f and d==9){ ans=dp[0]-1; if(ans<0) ans+=mod; }else{ ans=dp[d%9]; } cout<