#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x enumdigsum(string S) { static ll dp[205][2050]; int tot=0,i,x,y; map R; if(dp[0][0]==0) { dp[0][0]=1; FOR(i,202) FOR(y,2000) FOR(x,10) (dp[i+1][y+x]+=dp[i][y])%=mo; } reverse(S.begin(),S.end()); while(S.size()) { int x=S[D.size()-1]-'0'; FOR(i,x) FOR(y,2020) if(dp[S.size()-1][y]) (R[y+tot+i] += dp[S.size()-1][y])%=mo; tot+=x; S.pop_back(); } R[tot]++; return R; } void solve() { cin>>M>>D; map MM = enumdigsum(M); map DD = enumdigsum(D); ll ret=0; ITR(it,MM) if(it->first) ret += it->second*DD[it->first]%mo; cout<