#pragma once
#include <bits/stdc++.h>
usingnamespacestd;template<intMOD>structModInt{public:longlongx;ModInt(longlongx=0):x((x%MOD+MOD)%MOD){}constexprModInt&operator+=(constModInta)noexcept{if((x+=a.x)>=MOD)x-=MOD;return*this;}constexprModInt&operator-=(constModInta)noexcept{if((x+=MOD-a.x)>=MOD)x-=MOD;return*this;}constexprModInt&operator*=(constModInta)noexcept{(x*=a.x)%=MOD;return*this;}constexprModInt&operator/=(constModInta)noexcept{return*this*=a.inverse();}constexprModIntoperator+(constModInta)constnoexcept{returnModInt(*this)+=a.x;}constexprModIntoperator-(constModInta)constnoexcept{returnModInt(*this)-=a.x;}constexprModIntoperator*(constModInta)constnoexcept{returnModInt(*this)*=a.x;}constexprModIntoperator/(constModInta)constnoexcept{returnModInt(*this)/=a.x;}friendconstexprstd::ostream&operator<<(std::ostream&os,constModInt<MOD>a)noexcept{returnos<<a.x;}friendconstexprstd::istream&operator>>(std::istream&is,ModInt<MOD>&a)noexcept{is>>a.x;a.x=(a.x%MOD+MOD)%MOD;returnis;}ModIntinverse()constnoexcept{// x ^ (-1)longlonga=x,b=MOD,p=1,q=0;while(b){longlongd=a/b;a-=d*b;swap(a,b);p-=d*q;swap(p,q);}returnModInt(p);}ModIntpow(longlongN)constnoexcept{// x ^ NModInta=1;ModInty=this->x;while(N){if(N&1)a*=y;y*=y;N>>=1;}returna;}};template<typenameU,intMOD>inlineModInt<MOD>operator*(constU&c,constModInt<MOD>&a){return{c*a.x};}usingmint=ModInt<998244353>;
#line 2 "math/mint.cpp"
#include <bits/stdc++.h>
usingnamespacestd;template<intMOD>structModInt{public:longlongx;ModInt(longlongx=0):x((x%MOD+MOD)%MOD){}constexprModInt&operator+=(constModInta)noexcept{if((x+=a.x)>=MOD)x-=MOD;return*this;}constexprModInt&operator-=(constModInta)noexcept{if((x+=MOD-a.x)>=MOD)x-=MOD;return*this;}constexprModInt&operator*=(constModInta)noexcept{(x*=a.x)%=MOD;return*this;}constexprModInt&operator/=(constModInta)noexcept{return*this*=a.inverse();}constexprModIntoperator+(constModInta)constnoexcept{returnModInt(*this)+=a.x;}constexprModIntoperator-(constModInta)constnoexcept{returnModInt(*this)-=a.x;}constexprModIntoperator*(constModInta)constnoexcept{returnModInt(*this)*=a.x;}constexprModIntoperator/(constModInta)constnoexcept{returnModInt(*this)/=a.x;}friendconstexprstd::ostream&operator<<(std::ostream&os,constModInt<MOD>a)noexcept{returnos<<a.x;}friendconstexprstd::istream&operator>>(std::istream&is,ModInt<MOD>&a)noexcept{is>>a.x;a.x=(a.x%MOD+MOD)%MOD;returnis;}ModIntinverse()constnoexcept{// x ^ (-1)longlonga=x,b=MOD,p=1,q=0;while(b){longlongd=a/b;a-=d*b;swap(a,b);p-=d*q;swap(p,q);}returnModInt(p);}ModIntpow(longlongN)constnoexcept{// x ^ NModInta=1;ModInty=this->x;while(N){if(N&1)a*=y;y*=y;N>>=1;}returna;}};template<typenameU,intMOD>inlineModInt<MOD>operator*(constU&c,constModInt<MOD>&a){return{c*a.x};}usingmint=ModInt<998244353>;