#include #include using namespace atcoder; templatestruct ve; using ml=modint;using m1=ve; auto&operator>>(std::istream&i,ml&x){long long t;i>>t;x=t;return i;} auto&operator<<(std::ostream&o,const ml&x){return o<0;) #define FOR(i,...) for(au[i,i##O,i##E]=rng(0,__VA_ARGS__);i=i##O;i-=i##E) #define fs(i,...) for(ll i##E=__VA_ARGS__,i=i##E;i;--i&=i##E) #define debug(...) pp(#__VA_ARGS__,__VA_ARGS__) #define JO(a,b) a##b #define jo(a,b) JO(a,b) #define I(...) template<__VA_ARGS__> #define J typename #define O operator #define au auto #define cs const #define ifc if constexpr #define rr return #define uu using uu std::cin,std::cout,std::begin,std::end,std::rbegin,std::get; uu std::swap,std::move,std::gcd,std::lcm,std::abs,std::prev,std::next; uu std::deque,std::tuple,std::array,std::bitset,std::minmax; uu vo=void;uu bo=bool; vo solve(); I(J A,J B)constexpr bo same=std::is_same_v; I(bo b,J A,J B)uu ift=std::conditional_t; uu is=std::istream;uu os=std::ostream; uu dd=long double;uu ll=long long;uu ull=unsigned long long; uu lll=__int128_t;uu ulll=__uint128_t;uu str=std::string; dd ee=1e-12,pi=acosl(-1); ll oo=3e18,i998244353=998244353,i1000000007=1000000007; arraydx{-1,0,1,0,-1,1,1,-1},dy{0,-1,0,1,-1,-1,1,1}; char sp=32,nl=10; I(J T,J U=T)uu map=std::map; I(J T,J U=T)uu umap=std::unordered_map; I(J T)uu qmax=std::priority_queue; I(J T)uu qmin=std::priority_queue,std::greater<>>; I(J T,ll n)au TP(){ifc(n)rr tuple_cat(tuple(T()),TP());else rr tuple();} I(J T,ll n)uu tp=decltype(TP());I(ll n)uu tpl=tp; au rng(bo s,ll a,ll b=oo,ll c=1){if(b==oo)b=a,a=0;rr tuple{a,b-s,c};} I(J T)T zz(T x){rr x<0?-x:x;} I(J T)ll len(cs T&a){rr a.size();} struct edg{ll t,w;edg(){}edg(ll t,ll w=1):t(t),w(w){}}; I(J A,J B=A)struct cp{ A a={};B b={}; cp(){} cp(A a,B b):a(a),b(b){} cp(std::pairp):a(p.first),b(p.second){} cp O-()cs{rr cp(-a,-b);} cp&O+=(cs cp&c){a+=c.a,b+=c.b;rr*this;}cp O+(cs cp&c)cs{rr cp{*this}+=c;} cp&O-=(cs cp&c){a-=c.a,b-=c.b;rr*this;}cp O-(cs cp&c)cs{rr cp{*this}-=c;} bo O==(cs cp&c)cs{rr a==c.a&&b==c.b;} bo O<(cs cp&c)cs{rr a!=c.a?a(cs cp&c)cs{rr a!=c.a?a>c.a:b>c.b;} I(J T)cp&O+=(cs T&x){a+=x,b+=x;rr*this;}I(J T)cp O+(cs T&x)cs{rr cp{*this}+=x;} I(J T)cp&O-=(cs T&x){a-=x;b-=x;rr*this;}I(J T)cp O-(cs T&x)cs{rr cp{*this}-=x;} I(J T)cp&O*=(cs T&x){a*=x;b*=x;rr*this;}I(J T)cp O*(cs T&x)cs{rr cp{*this}*=x;} au abs()cs{rr zz(a)+zz(b);}au abs(cs cp&c)cs{rr(*this-c).abs();} };uu cl=cp; I(J A,J B=A,J C=A)struct tr{ A a={};B b={};C c={}; tr(){} tr(A a,B b,C c):a(a),b(b),c(c){} bo O==(cs tr&t)cs{rr a==t.a&&b==t.b&&c==t.c;} bo O<(cs tr&t)cs{rr a!=t.a?a(cs tr&t)cs{rr a!=t.a?a>t.a:b!=t.b?b>t.b:c>t.c;} };uu tl=tr; I(J V)struct ve; I(J V)constexpr bo isv=0; I(J V)constexpr bo isv> =1; I(J V)constexpr bo isv> =1; I(J V)au raw_val(V){ifc(isv)rr raw_val(V(1)[0]);else rr V();} I(J V)struct ve:std::vector{ uu std::vector::vector; uu raw_type=decltype(raw_val(V())); I(J U)ve(cs std::vector&v={}){fe(v,e)this->eb(e);} au&O+=(cs ve&u){au&v=*this;fo(i,len(v))v[i]+=u[i];rr v;} au&O-=(cs ve&u){au&v=*this;fo(i,len(v))v[i]-=u[i];rr v;} au&O^=(cs ve&u){fe(u,e)this->eb(e);rr*this;} au&O+=(cs raw_type&c){au&v=*this;fe(v,e)e+=c;rr v;} au&O-=(cs raw_type&c){au&v=*this;fe(v,e)e-=c;rr v;} au&O*=(cs raw_type&c){au&v=*this;fe(v,e)e*=c;rr v;} I(size_t n)au&O+=(cs bitset&a){fo(i,len(*this))(*this)[i]+=a[i];rr*this;} I(size_t n)au&O-=(cs bitset&a){fo(i,len(*this))(*this)[i]-=a[i];rr*this;} au O+(cs ve&u){rr ve(*this)+=u;} au O-(cs ve&u){rr ve(*this)-=u;} au O^(cs ve&u){rr ve(*this)^=u;} au O+(cs raw_type&c){rr ve(*this)+=c;}au&O++(){rr*this+=1;} au O-(cs raw_type&c){rr ve(*this)-=c;}au&O--(){rr*this-=1;} au O*(cs raw_type&c){rr ve(*this)*=c;}au O-(){rr ve(*this)*=-1;} vo af(V e={}){this->ep(begin(*this),e);} I(bo f(raw_type&,cs raw_type&))au scan(){ cpr; fe(*this,e)ifc(!isv)r.b?f(r.a,e),r:r={e,1};ef(au t=e.template scan();t.b)r.b?f(r.a,t.a),r:r=t;rr r; } au zeta(){ve v=*this;ifc(isv)fe(v,e)e=e.zeta();fo(i,len(v)-1)v[i+1]+=v[i];rr v;} au de(cs str&b="a"){ ift,ve,str>r; ifc(isv)fe(*this,e)r.eb(e.de(b)); else fe(*this,e)r+=len(b)==1?e+b[0]:0<=e&&e(s[i],x);else{au X=vec(s,x);rr ve(s[i],X);}} I(ll n,J...A)vo setsize(cs ll(&l)[n],A&...a){((a=vec(l,raw_val(a))),...);} I(J T)uu V1=ve;uu u1=V1;I(J T)uu V2=V1>;uu u2=V2; uu strs=V1;uu gra=V2;uu cls=V1;uu tls=V1; I(J T)decltype(au)rb(T&a){rr*rbegin(a);} I(J T)au pot(T&a){au r=a.top();a.pop();rr r;} struct io{io(){cin.tie(0)->sync_with_stdio(0); cout<&q){fe(q,e)o<q){wh(len(q))o<q){wh(len(q))o<&b){fo(i,n)o<&c){rr o<&m){fe(m,e)o<&t){rr o<&t){ apply([&](cs au&...a){ll i=0;(((o<&v){fe(v,e)o<?nl:sp);rr o;} I(J...A)vo pp(cs A&...a){ll i=0;((cout<>(is&i,cp&c){rr i>>c.a>>c.b;} I(J T,J U,J V)is&O>>(is&i,tr&t){rr i>>t.a>>t.b>>t.c;} I(J V)is&O>>(is&i,std::vector&v){fe(v,e)i>>e;rr i;} I(J...A)vo li(A&...a){(cin>>...>>a);} I(J...A)vo vi(A&...a){fo(i,(len(a)&...))(cin>>...>>a[i]);} I(J T)struct set:std::set{ set(cs V1&a={}){fe(a,e)this->ep(e);} friend os&O<<(os&o,cs set&s){fe(s,e)o<{ mset(cs V1&a={}){fe(a,e)this->ep(e);} friend os&O<<(os&o,cs mset&s){fe(s,e)o<{ uset(cs V1&a={}){fe(a,e)this->ep(e);} friend os&O<<(os&o,cs uset&s){fe(s,e)o<(a.zeta()^b.zeta()))); }