#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;i=MOD)dp[pos+1][md]-=MOD; int nmd = (md*10+c)%m; dp[pos+1][nmd] += dp[pos][md]; if(dp[pos+1][nmd]>=MOD)dp[pos+1][nmd]-=MOD; } } int ans = dp[n][0]+cnt0; if(ans>=MOD)ans-=MOD; printf("%d\n",ans); return 0; }