#include using namespace std; #if __has_include() #include using namespace atcoder; #endif using ll = long long; using ld = long double; using ull = unsigned long long; #define endl "\n" typedef pair Pii; #define REP(i, n) for (int i = 0; i < (n); ++i) #define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i)) #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++) #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(x) begin(x), end(x) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(s) (s).begin(),(s).end() #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) #define rever(vec) reverse(vec.begin(), vec.end()) #define sor(vec) sort(vec.begin(), vec.end()) #define fi first #define se second #define pb push_back #define P pair #define PQminll priority_queue, greater> #define PQmaxll priority_queue,less> #define PQminP priority_queue, greater

> #define PQmaxP priority_queue,less

> #define NP next_permutation typedef string::const_iterator State; class ParseError {}; //const ll mod = 1000000009; //const ll mod = 998244353; //const ll mod = 1000000007; const ll mod = 120586241; const ll inf = 4100000000000000000ll; const ld eps = ld(0.00000000001); //static const long double pi = 3.141592653589793; templatevoid vcin(vector &n){for(int i=0;i>n[i];} templatevoid vcin(vector &n,vector &m){for(int i=0;i>n[i]>>m[i];} templatevoid vcout(vector &n){for(int i=0;ivoid vcin(vector> &n){for(int i=0;i>n[i][j];}}} templatevoid vcout(vector> &n){for(int i=0;iauto min(const T& a){ return *min_element(all(a)); } templateauto max(const T& a){ return *max_element(all(a)); } templatevoid print(pair a){cout<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b void ifmin(T t,T u){if(t>u){cout<<-1< void ifmax(T t,T u){if(t>u){cout<<-1<>=1;v>>=1;}else if(eu&&!ev){u>>=1;}else if(!eu&&ev){v>>=1;}else if(u>=v){u=(u-v)>>1;}else{ll tmp=u;u=(v-u)>>1;v=tmp;}}return !u?v<>= 1; } return ret; } vector divisor(ll x){ vector ans; for(ll i = 1; i * i <= x; i++){ if(x % i == 0) {ans.push_back(i); if(i*i!=x){ ans.push_back(x / ans[i]);}}}sor(ans); return ans; } ll pop(ll x){return __builtin_popcountll(x);} ll poplong(ll x){ll y=-1;while(x){x/=2;y++;}return y;} P hyou(P a){ll x=fastgcd(abs(a.fi),abs(a.se));a.fi/=x;a.se/=x;if(a.se<0){a.fi*=-1;a.se*=-1;}return a;} P Pplus(P a,P b){ return hyou({a.fi*b.se+b.fi*a.se,a.se*b.se});} P Ptimes(P a,ll b){ return hyou({a.fi*b,a.se});} P Ptimes(P a,P b){ return hyou({a.fi*b.fi,a.se*b.se});} P Pminus(P a,P b){ return hyou({a.fi*b.se-b.fi*a.se,a.se*b.se});} P Pgyaku(P a){ return hyou({a.se,a.fi});} void cincout(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(15); } using mint = modint; mint x; ll sum(ll x,vector base={-1}){ if(base.size()>0&&base[0]==-1){ ll res=0; while(x){ res+=x/10; x/=10; } return res; } else{ ll res=0; ll now=1; for(int i=0;i &a,ll sign){ ll n=a.size(); ll g=6; ll h=modPow(g,(mod-1)/n,mod); if(sign==-1) h=modPow(h,mod-2,mod); ll i=0; for(int j=1;j>1);k>(i^=k);k>>=1){ } if(j> _twofft(vector> a,vector> b){ int n=a.size(); int m=a[0].size(); int p=1; while(p> c(n,vector(m)); for(int i=0;i twofft(vector a,vector b,vector base={-1}){ ll n=a.size(); ll k=base.size(); if(base[0]==-1){ k=-1; ll x=n; while(x){ k++; x/=10; } } vector> c(k,vector(n)); vector> d(k,vector(n)); for(int i=0;i res(n); for(int i=0;i multiinv(vector f,vector base={-1}){ ll n=f.size(); ll k=base.size(); if(int(base.size())>=1&&base[0]==-1){ k=-1; base={}; ll x=n; while(x){ k++; x/=10; } for(int i=0;i g(n/base[k-1]); for(int i=0;i base2=base; base2.pop_back(); g=multiinv(g,base2); for(int d=n/base[k-1];d f2(d*2),g2(d*2); for(int i=0;i res(d*2); for(int i=0;i> station(vector f,vector base={-1}){ ll n=f.size(); ll k=base.size(); if(base[0]==-1){ base={}; k=-1; ll x=n; while(x){ x/=10; k++; } for(int i=0;i> f2(k,vector(n)); for(int i=0;i diff(vector f){ for(int i=0;i integ(vector f){ for(int i=0;i multilog(vector f,vector base={-1}){ ll n=f.size(); ll k=base.size(); if(base[0]==-1){ base={}; k=-1; ll x=n; while(x){ k++; x/=10; } for(int i=0;i> f2(2*k,vector(n)),g2(2*k,vector(n)); for(int i=0;i f3,g3; for(int i=0;i<2*k;i++){ for(int j=0;j res(n); for(int i=0;i multiexp(vector f,vector base){ ll n=f.size(); ll k=base.size(); if(base.size()>=1&&base[0]==-1){ base={}; k=-1; ll x=n; while(x){ k++; x/=10; } for(int i=0;i g(n/base[k-1]); for(int i=0;i base2=base; base2.pop_back(); g=multiexp(g,base2); ll x=1; for(int d=n/base[k-1];d res(d*2); for(int i=0;i g2=multilog(g,base3); for(int i=0;i<2*d;i++) res[i]-=g2[i]; vector g3(2*d); for(int i=0;i multipow(vector f,vector base,ll p){ if(f[0].val()!=0){ mint x=f[0]; for(int i=0;i now(n); now[0]=1; while(k){ if(k%2){ now=twofft(now,f,base); } f=twofft(f,f,base); k/=2; } return now; } } vector solve(ll n,ll m,ll p,vector f){ if(n==m){ vector base; for(int i=0;i res(10); res[0]=1; while(p){ if(p%2){ vector res2(10); for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ res2[(i+j)%10]+=res[i]*f[j]; } } res=res2; } vector g(10); for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ g[(i+j)%10]+=f[i]*f[j]; } } f=g; p/=2; } return res; } else{ ll u=f.size(); vector xp(100); xp[0]=1; for(int i=1;i<100;i++) xp[i]=xp[i-1]*x; vector> f2(10,vector(u/10)); for(int i=0;i<10;i++){ for(int j=0;j f3(u); for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ for(int k=0;k>n>>k>>m>>t; ll a=1; for(int i=0;i f(a); for(int i=0;i>p; f[p]++; } vector ans=solve(k,t,m,f); for(int i=0;i