• 个人简介

    :::info[板子(new)]

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    #define Int __int128
    #define endl "\n"
    #define ER(x) cerr<<#x<<'='<<x<<' ';
    #define ce(x) if(debug){ER(x) ED}
    #define ce2(x,y) if(debug){ER(x) ER(y) ED}
    #define ce3(x,y,z) if(debug){ER(x) ER(y) ER(z) ED}
    #define ce4(x,y,z,w) if(debug){ER(x) ER(y) ER(z) ER(w) ED}
    #define ce5(x,y,z,w,r) if(debug){ER(x) ER(y) ER(z) ER(w) ER(r) ED}
    #define ED cout<<endl;
    #define ci(x) cin>>(x);
    #define ci2(x,y) cin>>(x)>>(y);
    #define ci3(x,y,z) cin>>(x)>>(y)>>(z);
    #define ci4(x,y,z,w) cin>>(x)>>(y)>>(z)>>(w);
    #define ci5(x,y,z,w,r) cin>>(x)>>(y)>>(z)>>(w)>>(r);
    #define cr(x) cout<<(x)<<endl;
    #define cr2(x,y) cout<<(x)<<" "<<(y)<<endl;
    #define cr3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl;
    #define cr4(x,y,z,w) cout<<(x)<<" "<<(y)<<" "<<(z)<<" "<<(w)<<endl;
    #define cr5(x,y,z,w,r) cout<<(x)<<" "<<(y)<<" "<<(z)<<" "<<(w)<<" "<<(r)<<endl;
    #define pi pair<int,int>
    #define x first
    #define y second
    #define For(n) for(int i=0;i<n;i++)
    #define FOR(n) for(int i=1;i<=n;i++)
    #define Forj(n) for(int j=0;j<n;j++)
    #define FORj(n) for(int j=1;j<=n;j++)
    #define lb(n) (n&-n)
    #define m0(n) memset(n,0,sizeof(n));
    #define fil(n,m) fill(n,n+sizeof(n)/sizeof(int),m);
    #define BSR(l,r) while(l<r){int m=l+r+1>>1;if(check(m))l=m;else r=m-1;}//find max check=1
    #define BSL(l,r) while(l<r){int m=l+r>>1;if(check(m))r=m;else l=m+1;}//find min check=1
    #define LSH(v) sort(v.begin(),v.end()),v.erase(unique(v.begin(),v.end()),v.end())//离散化
    #define UNI(v) v.erase(unique(v.begin(),v.end()),v.end())//去重
    #define Vi vector<int>
    #define V vector
    #define pb push_back
    #define sz(x) ((int)(x).size())
    #define all(x) (x).begin(),(x).end()
    #define MIN(x) *min_element(all(x))
    #define MAX(x) *max_element(all(x))
    const int _ = 1000005, mod = 998244353, INF = 922337203685775807ll;
    const bool debug = false;
    //Hong
    #define SZSZ//BIT,A(x,v) and Q(l,r)
    #define QPOW//qpow(a,b),mpow(a,b,mod)
    #define DSU_ //DSU,fnd,U(x,y):union,C(x,y) is same?
    //#define FACTOR//F and IF,C(x,y) and Cat(x) based on QPOW
    		//Use INITc(N) first
    //#define PRIME //isp[]:isprime pr[i] ith prime mn[i]:min 质因子
    		//use INITp(N) first
    #define Segtree//segment tree A(l,r,x):[l,r] add x,Q(l,r):sum [l,r] 1-index!!!!
    
    #ifdef SZSZ
    struct BIT{int n;vector<int>A_;BIT(int q):n(q),A_(q+1,0){}BIT(int q,vector<int>a):n(q),A_(a){}void A(int x,int t){for(;x<=n;x+=x&-x)A_[x]+=t;}int Q_(int x){int res=0;for(;x>0;x-=x&-x)res+=A_[x];return res;}int Q(int l,int r){return Q_(r)-Q_(l-1);}};
    #endif
    #ifdef QPOW
    int qpow(int a,int b){int ans=1,res=a;while(b){if(b&1)ans=ans*res%mod;b>>=1;res=res*res%mod;}return ans;}int mpow(int a,int b,int md){int ans=1,res=a;while(b){if(b&1)ans=ans*res%md;b>>=1;res=res*res%md;}return ans;}
    #endif
    #ifdef DSU_
    struct DSU{int n;Vi fa,Sz;DSU(int q):n(q),fa(q+1),Sz(q+1,1){FOR(n)fa[i]=i;}int fnd(int x){return fa[x]==x?x:fa[x]=fnd(fa[x]);}void U(int x,int y){x=fnd(x),y=fnd(y);if(x!=y){if(Sz[x]<Sz[y])swap(x,y);fa[y]=x,Sz[x]+=Sz[y];}}bool C(int x,int y){return fnd(x)==fnd(y);}};
    #endif
    #ifdef FACTOR
    int F[_],IF[_];int C(int n,int m){if(m<0||m>n)return 0;return F[n]*IF[m]%mod*IF[n-m]%mod;}int Ca(int a){return F[2*a]*IF[a]%mod*IF[a+1]%mod;}void INITc(int n){F[0]=1;FOR(n)F[i]=F[i-1]*i%mod;IF[n]=qpow(F[n],mod-2);for(int i=n-1;~i;i--)IF[i]=IF[i+1]*(i+1)%mod;}
    #endif
    #ifdef PRIME
    bitset<_>isp;int pr[_],mn[_],pc;void initp(int n){for(int i=2;i<=n;i++){if(!mn[i])mn[i]=i,pr[++pc]=i,isp[i]=1;for(int j=1;j<=pc&&pr[j]*i<=n;j++){mn[pr[j]*i]=pr[j];if(i%pr[j]==0)break;}}}
    #endif
    #ifdef Segtree
    struct Seg{int n;vector<int>a,p,ad;Seg(int A,vector<int>&arr):a(arr),p(A<<2),ad(A<<2){n=A;build(1,1,n);}void psdn(int o,int l,int r){if(l==r){p[o]+=ad[o];ad[o]=0;return;}ad[(o<<1)]+=ad[o];ad[(o<<1|1)]+=ad[o];p[(o<<1)]+=(ad[o]*(((l+r)>>1)-l+1));p[(o<<1|1)]+=(ad[o]*(r-((l+r)>>1)));ad[o]=0;}int build(int o,int l,int r){if(l==r)return p[o]=a[r];return p[o]=build((o<<1),l,((l+r)>>1))+build((o<<1|1),((l+r)>>1)+1,r);}void add(int o,int l,int r,int x,int y,int as){if(l>=x&&r<=y){ad[o]+=as;p[o]+=as*(r-l+1);return;}psdn(o,l,r);if(((l+r)>>1)>=x)add((o<<1),l,((l+r)>>1),x,y,as);if(((l+r)>>1)+1<=y)add((o<<1|1),((l+r)>>1)+1,r,x,y,as);p[o]=p[(o<<1)]+p[(o<<1|1)];}int query(int o,int l,int r,int x,int y){if(l>=x&&r<=y){return p[o];}psdn(o,l,r);int anss=0;if(((l+r)>>1)>=x)anss+=query((o<<1),l,((l+r)>>1),x,y);if(((l+r)>>1)+1<=y)anss+=query((o<<1|1),((l+r)>>1)+1,r,x,y);return anss;}void A(int l,int r,int x){add(1,1,n,l,r,x);}int Q(int l,int r){return query(1,1,n,l,r);}};
    #endif
    void QK() {}
    const bool DC=0;//多测?
    int n;
    void SLV() {
    	ci(n)
        Vi a(n);
    
    }
    const string FLNM="";
    signed main() {
    	if(FLNM!="")freopen((FLNM+".in").c_str(),"r",stdin),freopen((FLNM+".out").c_str(),"wb",stdout);ios::sync_with_stdio(0);cin.tie(0);if(DC){int ToT=0;ci(ToT)while(ToT--){QK();SLV();}}else SLV();
    }
    
    
    
    

    :::

    :::info[板子(old)]

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    #define endl "\n"
    #define ER(x) cerr<<#x<<'='<<x<<' ';
    #define ce(x) if(debug){ER(x) ED}
    #define ce2(x,y) if(debug){ER(x) ER(y) ED}
    #define ce3(x,y,z) if(debug){ER(x) ER(y) ER(z) ED}
    #define ce4(x,y,z,w) if(debug){ER(x) ER(y) ER(z) ER(w) ED}
    #define ce5(x,y,z,w,r) if(debug){ER(x) ER(y) ER(z) ER(w) ER(r) ED}
    #define ED cout<<endl;
    #define ci(x) cin>>(x);
    #define ci2(x,y) cin>>(x)>>(y);
    #define ci3(x,y,z) cin>>(x)>>(y)>>(z);
    #define ci4(x,y,z,w) cin>>(x)>>(y)>>(z)>>(w);
    #define ci5(x,y,z,w,r) cin>>(x)>>(y)>>(z)>>(w)>>(r);
    #define cr(x) cout<<(x)<<endl;
    #define cr2(x,y) cout<<(x)<<" "<<(y)<<endl;
    #define cr3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl;
    #define cr4(x,y,z,w) cout<<(x)<<" "<<(y)<<" "<<(z)<<" "<<(w)<<endl;
    #define cr5(x,y,z,w,r) cout<<(x)<<" "<<(y)<<" "<<(z)<<" "<<(w)<<" "<<(r)<<endl;
    #define pi pair<int,int>
    #define x first
    #define y second
    #define For(n) for(int i=0;i<n;i++)
    #define FOR(n) for(int i=1;i<=n;i++)
    #define Forj(n) for(int j=0;j<n;j++)
    #define FORj(n) for(int j=1;j<=n;j++)
    #define lb(n) (n&-n)
    #define m0(n) memset(n,0,sizeof(n));
    #define fil(n,m) fill(n,n+sizeof(n)/sizeof(int),m);
    #define sz(x) ((int)x.size())
    const int _ = 1000005,mod=998244353,INF=9223372036854775807ll;
    const bool debug = false;
    void QK(){}
    void SLV(){
    	
    }
    signed main() {
    //	freopen(".in", "r", stdin);
    //	freopen(".out", "w", stdout);
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    //int ToT=0;
    //ci(ToT)
    //while(ToT--){
    //	QK();
    	SLV();
    //}
    }
    
    

    :::

    :::info[多项式板子]

    const int MAX_LOG=18+1;//n=1e5
    const int _=(1ll<<(MAX_LOG))+20,mod=998244353,INF=9223372036854775807ll,g=3,Ny=332748118;
    const bool debug=false;
    typedef unsigned long long ull;
    const ull MOD = mod;
    const ull BARRETT = ((1ull << 63) / MOD) + 1;  
    namespace DXS{
    int LIM=1,L=0,R[_],NOWLIM=-1;
    int roots[2][MAX_LOG+1][1<<MAX_LOG];
    bool rt=0;
    int Inv[(1ll<<MAX_LOG)+10];
    inline int qpow(int b,int a) {
    	int ans=1,res=b;
    	while(a) {
    		if(a&1)ans=ans*res%mod;
    		res=res*res%mod;
    		a>>=1;
    	}
    	return ans;
    }
    
    inline int ny(int a) {
    	return qpow(a,mod-2)%mod;
    }
    
    inline int Z(int a) {
    	return a+(a<0)*mod;
    }
    
    // 多项式基本操作
    using Poly = vector<int>;
    
    inline int deg(const Poly& a) { return (int)a.size() - 1; } // 最高次
    inline void set_deg(Poly& a, int d) { a.resize(d + 1, 0); } // 设置最高次
    inline void trim(Poly& a) { while(a.size() > 1 && a.back() == 0) a.pop_back(); } // 去除高位0
    
    void print(const Poly& a) {
    	For(a.size()) cout << a[i] << ' ';
    	ED
    }
    
    void input(Poly& a) {
    	For(a.size()) ci(a[i])
    }
    inline int add(int a, int b) {
        int s = a + b;
        return s - (s >= mod) * mod;
    }
    inline int mul(int a, int b) {
        return ((ull)a*b)%mod;
    }
    inline void NTT(Poly& a, bool type) {
        int* A = a.data();
        for (int i = 0; i < LIM; ++i)
            if (i < R[i]) swap(A[i], A[R[i]]);
        int log_mid = 1;
        for (int mid = 1; mid < LIM; mid <<= 1, ++log_mid) {
            int* w = roots[type][log_mid];
            int Rt = mid << 1;
            for (int j = 0; j < LIM; j += Rt) {
                int* p1 = A + j;
                int* p2 = A + j + mid;
                for (int k = 0; k < mid; ++k) {
                    int x = p1[k], y = mul(w[k], p2[k]);
                    p1[k] = add(x, y);
                    p2[k] = Z(x-y);
                }
            }
        }
        if (!type) {
            int I = qpow(LIM, mod - 2);
            for (int i = 0; i < LIM; ++i) A[i] = mul(A[i], I);
        }
    }
    inline void initR(int LI) {
    	if(NOWLIM == LI) return;
    	For(LIM) R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
    	NOWLIM=LI;
    }
    
    Poly mul(const Poly& A, const Poly& B) {//乘 
    	while(LIM <= deg(A) + deg(B)) LIM <<= 1, L++;
    	initR(LIM);
    	Poly At(LIM, 0); copy(A.begin(), A.end(), At.begin());
        Poly Bt(LIM, 0); copy(B.begin(), B.end(), Bt.begin());
    	NTT(At, 1), NTT(Bt, 1);
    	For(LIM) At[i] = mul(At[i],Bt[i]);
    	NTT(At, 0);
    	At.resize(deg(A) + deg(B) + 1, 0);
    	trim(At);
    	return At;
    }
    
    Poly ZY(Poly a, int k) { // 左移k位,乘以x^k
    	if(k >= (int)a.size()) return {0};
    	a.erase(a.begin(), a.begin() + k);
    	return a;
    }
    
    Poly YY(Poly a, int k) { // 右移k位,除以x^k
    	a.insert(a.begin(), k, 0);
    	return a;
    }
    
    Poly WEI(Poly a, int d) { // 截断到d次
    	a.resize(d + 1, 0);
    	return a;
    }
    
    Poly add(const Poly& A, const Poly& B) {//加 
    	int mx = max(A.size(), B.size());
    	Poly res(mx);
    	For(mx) {
    		int va = (i < (int)A.size() ? A[i] : 0);
    		int vb = (i < (int)B.size() ? B[i] : 0);
    		res[i] = (va + vb) % mod;
    	}
    	trim(res);
    	return res;
    }
    
    Poly sub(const Poly& A, const Poly& B) {
    	int mx = max(A.size(), B.size());
    	Poly res(mx);
    	For(mx) {
    		int va = (i < (int)A.size() ? A[i] : 0);
    		int vb = (i < (int)B.size() ? B[i] : 0);
    		res[i] = (va - vb + mod) % mod;
    	}
    	trim(res);
    	return res;
    }
    
    Poly inv(const Poly& a) {
    	int n = a.size() - 1; // 最高次
    	Poly ans(1);
    	ans[0] = qpow(a[0], mod - 2);
    	for(int p = 1; p <= n; p <<= 1) {
    		LIM = 1, L = 0;
    		while(LIM <= (p << 1)) LIM <<= 1, L++;
            initR(LIM);
    		Poly tmp(a.begin(), a.begin() + min((int)a.size(), 2 * p));
    		tmp.resize(LIM, 0);
    		ans.resize(LIM, 0);
    		NTT(ans, 1), NTT(tmp, 1);
    		For(LIM) ans[i] =mul(ans[i],Z(2-mul(tmp[i],ans[i])));
    		NTT(ans, 0);
    		ans.resize(2 * p);
    	}
    	ans.resize(n + 1);
    	return ans;
    }
    
    Poly QIUDAO(const Poly& a) {
    	if(a.size() <= 1) return {0};
    	Poly res(a.size() - 1);
    	For(res.size()) res[i] = (i + 1)*a[i + 1]%mod;
    	return res;
    }
    
    Poly JIFEN(const Poly& a) {
    	Poly res(a.size() + 1);
    	res[0] = 0;
    	For(a.size()) res[i + 1] = a[i]*Inv[i+1]%mod;
    	trim(res);
    	return res;
    }
    Poly ln(const Poly& a) {
    	int n = a.size() - 1;
    	Poly tmp = inv(a);
    	Poly tmp2 = QIUDAO(a);
    	Poly ans = mul(tmp, tmp2);
    	ans.resize(n + 1);
    	ans = JIFEN(ans);
    	ans[0] = 0;
    	ans.resize(n + 1);
    	return ans;
    }
    
    Poly exp(const Poly& a) {
    	int n = a.size() - 1;
    	Poly B(1, 1);
    	for(int p = 1; p <= n; p <<= 1) {
    		Poly C = B;
    		C.resize(2 * p);
    		C = ln(C);
    		Poly D(2 * p);
    		For(D.size()) {
    			int va = (i < (int)a.size() ? a[i] : 0);
    			int vc = (i < (int)C.size() ? C[i] : 0);
    			D[i] = Z(va-vc);
    		}
    		D[0] = (D[0] + 1) % mod;
    		B = mul(B, D);
    		B.resize(2 * p);
    	}
    	B.resize(n + 1);
    	return B;
    }
    
    Poly _ksm(Poly a, int k) {
    	a = ln(a);
    	For(a.size()) a[i] = a[i] * k % mod;
    	return exp(a);
    }
    
    Poly ksm(Poly a, int k, int k_ = -1) {
    	int n = a.size() - 1;
    	int W = n;
    	if(k == 0) {
    		Poly res(W + 1, 0);
    		res[0] = 1;
    		return res;
    	}
    	if(k_ == -1) k_ = k;
    	int Ri = -1, X = 0;
    	For(a.size()) if(a[i] != 0) { Ri = i; X = a[i]; break; }
    	if(Ri == -1) return Poly(W + 1, 0);
    	a = ZY(a, Ri);
    	int invX = ny(X);
    	For(a.size()) a[i] = a[i] * invX % mod;
    	a = _ksm(a, k);
    	int powX = qpow(X, k_);
    	For(a.size()) a[i] = a[i] * powX % mod;
    	if(Ri * k > W) return Poly(W + 1, 0);
    	a = YY(a, Ri * k);
    	a.resize(W + 1, 0);
    	return a;
    }
    
    Poly rev(Poly a) {
    	reverse(a.begin(), a.end());
    	return a;
    }
    
    pair<Poly, Poly> div(const Poly& a, const Poly& b) {
    	int n = a.size() - 1, m = b.size() - 1;
    	if(n < m) return {Poly{0}, a};
    	Poly A = rev(a), B = rev(b);
    	B.resize(n - m + 1);
    	A.resize(n - m + 1);
    	B = inv(B);
    	Poly Q = mul(A, B);
    	Q.resize(n - m + 1);
    	Q = rev(Q);
    	Poly R = sub(a, mul(b, Q));
    	trim(Q); trim(R);
    	return {Q, R};
    }
    // 运算符重载
    inline Poly operator+(const Poly& a, const Poly& b) { return add(a, b); }
    inline Poly operator-(const Poly& a, const Poly& b) { return sub(a, b); }
    inline Poly operator*(const Poly& a, const Poly& b) { return mul(a, b); }
    inline Poly operator/(const Poly& a, const Poly& b) { return div(a, b).first; }
    inline Poly operator%(const Poly& a, const Poly& b) { return div(a, b).second; }
    inline Poly operator+(const Poly& a, int k) { Poly res = a; res[0] = (res[0] + k) % mod; return res; }
    inline Poly operator-(const Poly& a, int k) { return a + (-k); }
    inline Poly operator*(const Poly& a, int k) { Poly res = a; For(res.size()) res[i] = res[i] * k % mod; return res; }
    inline Poly operator/(const Poly& a, int k) { return a * ny(k); }
    inline Poly operator<<(const Poly& a, int k) { return ZY(a, k); } // 乘以x^k
    inline Poly operator>>(const Poly& a, int k) { return YY(a, k); } // 除以x^k
    inline Poly operator^(const Poly& a, int k) { return ksm(a, k); }
    };
    using namespace DXS;
    int n,k;
    signed main() {
    	for(int K=0;K<=1;K++){FOR(MAX_LOG){int len=1<<i;int wn=qpow(K?g:Ny,(mod-1)/len);roots[K][i][0]=1;Forj(len-1)roots[K][i][j+1]=roots[K][i][j]*wn%mod;}}
    	Inv[1] = 1;for (int i = 2; i <= 1ll<<MAX_LOG; ++i)Inv[i] =(mod - mod / i)*(Inv[mod % i])%mod;
    //	freopen(".in","r",stdin);
    //	freopen(".out","w",stdout);
    	ios::sync_with_stdio(0);
    	cin.tie(0);
        ci2(n,k)
        Poly a(n+1),b(k+1);
        input(a),input(b);
        print(a/b);
        print(a%b);
    	return 0;
    }
    
    

    ::: :::info[转载的高精度]

    #include<cmath>
    #include<iostream>
    #include<cstring>
    //********一些辅助函数与FFT实现
    const double PI=4*atan(1);
    template<typename T>
    void Swap(T &a,T &b){
    	T c=a;
    	a=b;
    	b=c;
    	return;
    }
    template<typename T>
    T Max(const T &a,const T &b){
    	return a<b?b:a;
    }
    typedef long long ll;
    struct comp{
    	double real,imag;
    	comp operator+(const comp &x)const{
    		return {real+x.real,imag+x.imag};
    	}
    	comp operator-(const comp &x)const{
    		return {real-x.real,imag-x.imag};
    	}
    	comp operator*(const comp &x)const{
    		return {real*x.real-imag*x.imag,real*x.imag+x.real*imag};
    	}
    	comp operator/(const unsigned &x)const{
    		return {real/(double)x,imag/(double)x};
    	}
    };
    void FFT(comp *f,unsigned n,int rev){
    	for(unsigned i=1,j=n>>1,k;i<n-1;i++){//位逆序置换
    		if(i<j)
    			Swap(f[i],f[j]);
    		k=n>>1;
    		while(j>=k){
    			j-=k;
    			k>>=1;
    		}
    		j+=k;
    	}
    	for(unsigned l=2;l<=n;l<<=1){//蝶形运算
    		double arg=2*PI*rev/l;
    		comp wn={cos(arg),sin(arg)};
    		for(unsigned i=0;i<n;i+=l){
    			comp w={1,0};
    			for(unsigned j=0;j<(l>>1);j++){
    				comp f1=f[i+j];
    				comp f2=f[i+j+(l>>1)];
    				f[i+j]=f1+w*f2;
    				f[i+j+(l>>1)]=f1-w*f2;
    				w=w*wn;
    			}
    		}
    	}
    	if(!~rev)
    		for(unsigned i=0;i<n;i++)
    			f[i]=f[i]/n;
    }
    //********高精度整数类
    #define BASE 100//因为FFT的精度问题严重,我们只压2位
    template<const unsigned Size>
    class bigint{
    private:
    	unsigned len;
    	int num[Size];
    	void init(){
    		memset(num,0,sizeof(num));
    		len=1;
    	}
    	bool abs_greater_equal(const bigint &a)const{
    		if(len!=a.len)
    			return len>a.len;
    		for(int i=len;i;i--)
    			if(num[i]!=a.num[i])
    				return num[i]>a.num[i];
    		return 1;
    	}
    public:
    	bigint(){
    		init();
    	}
    	void get_num(std::string s){
    		init();
    		int f=0;
    		unsigned slen=s.length();
    		if(s[0]=='-')
    			num[0]=f=1;
    		len=0;
    		unsigned temp=0,w=1;
    		for(int i=slen-1;i>=f;i--){
    			temp+=(s[i]^48)*w;
    			w=(w<<1)+(w<<3);
    			if(w==BASE||i==f){
    				num[++len]=(int)temp;
    				temp=0;
    				w=1;
    			}
    		}
    		if(temp||len==0)
    			num[++len]=temp;
    	}
    	bool operator<(const bigint &a)const{
    		if(num[0]&&!a.num[0])
    			return 1;
    		if(!num[0]&&a.num[0])
    			return 0;
    		if(num[0]){
    			if(len!=a.len)
    				return len>a.len;
    			for(int i=len;i;i--)
    				if(num[i]!=a.num[i])
    					return num[i]>a.num[i];
    		}
    		else{
    			if(len!=a.len)
    				return len<a.len;
    			for(int i=len;i;i--)
    				if(num[i]!=a.num[i])
    					return num[i]<a.num[i];
    		}
    		return 0;
    	}
    	bigint operator+(const bigint &a)const{
    		bigint res;
    		if(len==1&&num[1]==0){
    			res=a;
    			return res;
    		}
    		if(a.len==1&&a.num[1]==0){
    			res=*this;
    			return res;
    		}
    		if(num[0]==a.num[0]){
    			res.num[0]=num[0];
    			unsigned len_sum=1;
    			while(len_sum<len+a.len)
    				len_sum<<=1;
    			comp *fa=new comp[len_sum]();
    			comp *fb=new comp[len_sum]();
    			for(unsigned i=0;i<len;i++)
    				fa[i]={(double)num[i+1],0};
    			for(unsigned i=0;i<a.len;i++)
    				fb[i]={(double)a.num[i+1],0};
    			FFT(fa,len_sum,1);
    			FFT(fb,len_sum,1);
    			for(unsigned i=0;i<len_sum;i++)
    				fa[i]=fa[i]+fb[i];
    			FFT(fa,len_sum,-1);
    			res.len=Max(len,a.len);
    			ll temp=0;
    			for(unsigned i=0;i<res.len;i++){
    				ll val=(ll)round(fa[i].real)+temp;
    				res.num[i+1]=(int)(val%BASE);
    				temp=val/BASE;
    			}
    			if(temp)
    				res.num[++res.len]=temp;
    			while(res.len>1&&res.num[res.len]==0)
    				res.len--;
    			delete[] fa;
    			delete[] fb;
    		}
    		else{
    			if(abs_greater_equal(a)){
    				res.num[0]=num[0];
    				unsigned len_sum=1;
    				while(len_sum<len+a.len)
    					len_sum<<=1;
    				comp *fa=new comp[len_sum]();
    				comp *fb=new comp[len_sum]();
    				for(unsigned i=0;i<len;i++)
    					fa[i]={(double)num[i+1],0};
    				for(unsigned i=0;i<a.len;i++)
    					fb[i]={(double)a.num[i+1],0};
    				FFT(fa,len_sum,1);
    				FFT(fb,len_sum,1);
    				for(unsigned i=0;i<len_sum;i++)
    					fa[i]=fa[i]-fb[i];
    				FFT(fa,len_sum,-1);
    				res.len=Max(len,a.len);
    				ll temp=0;
    				for(unsigned i=0;i<res.len;i++){
    					ll val=(ll)round(fa[i].real)+temp;
    					if(val<0){
    						val+=BASE;
    						temp=-1;
    					}
    					else
    						temp=0;//借位
    					res.num[i+1]=(int)(val%BASE);
    				}
    				if(temp)
    					res.num[++res.len]=temp;
    				while(res.len>1&&res.num[res.len]==0)
    					res.len--;
    				delete[] fa;
    				delete[] fb;
    			}
    			else{
    				res.num[0]=a.num[0];
    				unsigned len_sum=1;
    				while(len_sum<len+a.len)
    					len_sum<<=1;
    				comp *fa=new comp[len_sum]();
    				comp *fb=new comp[len_sum]();
    				for(unsigned i=0;i<len;i++)
    					fa[i]={(double)num[i+1],0};
    				for(unsigned i=0;i<a.len;i++)
    					fb[i]={(double)a.num[i+1],0};
    				FFT(fa,len_sum,1);
    				FFT(fb,len_sum,1);
    				for(unsigned i=0;i<len_sum;i++)
    					fa[i]=fb[i]-fa[i];
    				FFT(fa,len_sum,-1);
    				res.len=Max(len,a.len);
    				ll temp=0;
    				for(unsigned i=0;i<res.len;i++){
    					ll val=(ll)round(fa[i].real)+temp;
    					if(val<0){
    						val+=BASE;
    						temp=-1;
    					}
    					else
    						temp=0;
    					res.num[i+1]=(int)(val%BASE);
    				}
    				if(temp)
    					res.num[++res.len]=temp;
    				while(res.len>1&&res.num[res.len]==0)
    					res.len--;
    				delete[] fa;
    				delete[] fb;
    			}
    			if(res.len==1&&res.num[1]==0)
    				res.num[0]=0;
    		}
    		return res;
    	}
    	bigint operator*(const bigint &a)const{
    		bigint res;
    		if((len==1&&num[1]==0)||(a.len==1&&a.num[1]==0))
    			return res;
    		res.num[0]=num[0]^a.num[0];
    		unsigned len_sum=1;
    		while(len_sum<len+a.len)
    			len_sum<<=1;
    		comp *fa=new comp[len_sum]();
    		comp *fb=new comp[len_sum]();
    		for(unsigned i=0;i<len;i++)
    			fa[i]={(double)num[i+1],0};
    		for(unsigned i=0;i<a.len;i++)
    			fb[i]={(double)a.num[i+1],0};
    		FFT(fa,len_sum,1);
    		FFT(fb,len_sum,1);
    		for(unsigned i=0;i<len_sum;i++)
    			fa[i]=fa[i]*fb[i];
    		FFT(fa,len_sum,-1);
    		res.len=len+a.len;
    		ll temp=0;
    		for(unsigned i=0;i<res.len;i++){
    			ll val=(ll)(fa[i].real+0.5)+temp;
    			res.num[i+1]=(int)(val%BASE);
    			temp=val/BASE;
    		}
    		if(temp)
    			res.num[++res.len]=temp;
    		while(res.len>1&&res.num[res.len]==0)
    			res.len--;
    		delete[] fa;
    		delete[] fb;
    		return res;
    	}
    	void read(){
    		init();
    		std::string s;
    		char ch=getchar();
    		while(ch<'0'||ch>'9'){
    			if(ch=='-')
    				s.push_back('-');
    			ch=getchar();
    		}
    		while(ch>='0'&&ch<='9'){
    			s.push_back(ch);
    			ch=getchar();
    		}
    		get_num(s);
    	}
    	void print(){
    		if(num[0])
    			putchar('-');
    		bool leading_zero=1;
    		for(int i=len;i;i--){
    			if(leading_zero)
    				printf("%d",num[i]);
    			else
    				printf("%02d",num[i]);
    			leading_zero=0;
    		}
    		putchar('\n');
    		return;
    	}
    };
    //********程序主体
    const int N=1<<10,M=100;
    int n,m;
    bigint<114514> a,b,c;
    int main(){
    	a.read();
    	b.read();
    	c=a+b;
    	c.print();
    	return 0;
    }
    
    

    ::: :::info[网络流]

    int n,m,s,t,u,v,w;
    #define BL(u) for(int i=head[u];i;i=e[i].nxt)
    namespace W{int tot=1,ans,MAX=0;int dis[_],now[_],head[_];struct edge{int to,nxt,val;}e[_];void add(int u,int v,int w){MAX=max(max(MAX,u),v);e[++tot].to=v;e[tot].val=w;e[tot].nxt=head[u];head[u]=tot;e[++tot].to=u;e[tot].val=0;e[tot].nxt=head[v];head[v]=tot;}bool bfs(){FOR(MAX)dis[i]=INF;queue<int>q;q.push(s);dis[s]=0,now[s]=head[s];while(!q.empty()){int u=q.front();q.pop();BL(u){int v=e[i].to;if(e[i].val>0&&dis[v]==INF){q.push(v);now[v]=head[v];dis[v]=dis[u]+1;if(v==t)return 1;}}}return 0;}int dfs(int x,int sum){if(x==t)return sum;int k,res=0;BL(x){if(sum==0)return res;now[x]=i;int v=e[i].to;if(e[i].val>0&&(dis[v]==dis[x]+1)){k=dfs(v,min(sum,e[i].val));if(k==0)dis[v]=INF;e[i].val-=k;e[i^1].val+=k;res+=k;sum-=k;}}return res;}int ANS(){int anss=0;while(bfs())anss+=dfs(s,INF);return anss;}};
    #undef BL
    
    

    ::: :::info[费用流(不能当网络流用)]

    #define BL(u) for(int i=head[u];i;i=e[i].nxt)
    int n,m,s,t,u,v,w,ww;
    namespace W{int tot=1,ans,MAXN=0;int V;int dis[_],now[_],head[_],inq[_];struct edge{int to,nxt,val,w;}e[_];void add(int u,int v,int w=1,int ww=1){MAXN=max({MAXN,u,v});e[++tot].to=v;e[tot].val=w;e[tot].nxt=head[u];e[tot].w=ww;head[u]=tot;now[u]=tot;e[++tot].to=u;e[tot].val=0;e[tot].nxt=head[v];e[tot].w=-ww;head[v]=tot;now[v]=tot;}bool sibufa(){FOR(MAXN)dis[i]=INF,now[i]=head[i];memcpy(now,head,sizeof(head));queue<int>q;q.push(s);dis[s]=0,now[s]=head[s],inq[s]=1;while(!q.empty()){int u=q.front();q.pop();inq[u]=0;BL(u){int v=e[i].to;if(e[i].val>0&&dis[v]>dis[u]+e[i].w){if(!inq[v])q.push(v),inq[v]=1;dis[v]=dis[u]+e[i].w;}}}return dis[t]<INF/2;}int dfs(int x,int sum){if(x==t)return sum;inq[x]=1;int k,res=0;BL(x){if(res>=sum)break;int v=e[i].to;if(!inq[v]&&e[i].val&&dis[v]==dis[x]+e[i].w){k=dfs(v,min(sum-res,e[i].val));if(k){V+=k*e[i].w,e[i].val-=k,e[i^1].val+=k,res+=k;}}}inq[x]=0;return res;}void DO(){while(sibufa()){int x;while((x=dfs(s,INF)))ans+=x;}}};
    #undef BL
    

    :::

    :::info[LCT]

    #define lc c[x][0]
    #define rc c[x][1]
    namespace LCT{int f[_],c[_][2],v[_],s[_];bool r[_];bool nrt(int x){return c[f[x]][0]==x||c[f[x]][1]==x;}void psup(int x){s[x]=s[lc]^s[rc]^v[x];}void psr(int x){int t=lc;lc=rc;rc=t;r[x]^=1;}void psdn(int x){if(r[x]){if(lc){psr(lc);}if(rc){psr(rc);}r[x]=0;}}void rotate(int x){int y=f[x],z=f[y],k=c[y][1]==x,w=c[x][!k];if(nrt(y))c[z][c[z][1]==y]=x;c[x][!k]=y;c[y][k]=w;if(w)f[w]=y;f[y]=x;f[x]=z;psup(y);}void psa(int x){if(nrt(x))psa(f[x]);psdn(x);}void splay(int x){int y=x,z=0;psa(x);while(nrt(x)){y=f[x];z=f[y];if(nrt(y))rotate((c[y][0]==x)^(c[z][0]==y)?x:y);rotate(x);}psup(x);}void access(int x){for(int y=0;x;x=f[y=x])splay(x),rc=y,psup(x);}void mkrt(int x){access(x),splay(x),psr(x);}int findrt(int x){access(x);splay(x);while(lc)psdn(x),x=lc;splay(x);return x;}void split(int x,int y){mkrt(x),access(y),splay(y);}void link(int x,int y){mkrt(x);if(findrt(y)!=x){f[x]=y;}}void cut(int x,int y){mkrt(x);if(findrt(y)==x&&f[y]==x&&!c[y][0]){f[y]=rc=0;psup(x);}}int ql(int x,int y){split(x,y);return s[y];}void gx(int x,int y){splay(x),v[x]=y;}};
    #undef lc
    #undef rc
    
    

    :::

    :::info[EXCRT]

    namespace C{
      #define ll __int128
    	int N,A[_],B[_];
    	ll n,x,y;
    	ll a[_],b[_];//x=b(mod a)
    	ll lcm(ll ak,ll bk) {
    		return ak/__gcd(ak,bk)*bk;
    	}
    	ll exgcd(ll a,ll b,ll &x,ll &y) {
    		if(b==0) {
    			x=1;
    			y=0;
    			return a;
    		}
    		ll d=exgcd(b,a%b,x,y);
    		ll t=x;
    		x=y;
    		y=t-a/b*y;
    		return d;
    	}
    	ll crt(){
    		n=N;
    		FOR(N)a[i]=A[i],b[i]=B[i];
    		ll aa=1,bb=0;
    		FOR(n){
    			ll A=a[i],B=b[i];
    			ll d=exgcd(aa,A,x,y);
    			x=(bb-B)/d*x;
    			bb-=aa*x;
    			aa=A/d*aa;
    			bb=(bb%aa+aa)%aa;
    		}
    		return (bb+aa)%aa;
    	}
    };
    

    ::: :::info[FHQ Treap]

    int n;
    mt19937 rnd(time(0));
    struct FHQT{struct node{int l,r,val,key,size;}fhq[_];int cnt,root;int newnode(int val){fhq[++cnt].val=val;fhq[cnt].size=1;fhq[cnt].key=rnd();return cnt;}void update(int now){fhq[now].size=fhq[fhq[now].l].size+fhq[fhq[now].r].size+1;}void split(int now,int val,int&x,int&y){if(!now)x=y=0;else{if(fhq[now].val<=val){x=now;split(fhq[now].r,val,fhq[now].r,y);}else{y=now;split(fhq[now].l,val,x,fhq[now].l);}update(now);}}void splitP(int now,int val,int&x,int&y){if(!now)x=y=0;else{if(val<=fhq[fhq[now].l].size){y=now;splitP(fhq[now].l,val,x,fhq[now].r);}else{x=now;splitP(fhq[now].r,val-fhq[fhq[now].l].size-1,fhq[now].r,y);}update(now);}}int merge(int x,int y){if(!x||!y)return x+y;if(fhq[x].key>fhq[y].key){fhq[x].r=merge(fhq[x].r,y);update(x);return x;}else{fhq[y].l=merge(x,fhq[y].l);update(y);return y;}}void ins(int val){int x,y;split(root,val,x,y);root=merge(merge(x,newnode(val)),y);}void del(int val){int x,y,z;split(root,val,x,z);split(x,val-1,x,y);y=merge(fhq[y].l,fhq[y].r);root=merge(merge(x,y),z);}int getrank(int val){int x,y,ans;split(root,val-1,x,y);ans=fhq[x].size+1;root=merge(x,y);return ans;}int getnum(int rank){int now=root;while(now){if(fhq[fhq[now].l].size+1==rank){break;}else if(fhq[fhq[now].l].size>=rank){now=fhq[now].l;}else{rank-=fhq[fhq[now].l].size+1;now=fhq[now].r;}}return fhq[now].val;}int pre(int val){int x,y;split(root,val-1,x,y);int now=x;while(fhq[now].r)now=fhq[now].r;int ans=fhq[now].val;root=merge(x,y);return ans;}int nxt(int val){int x,y;split(root,val,x,y);int now=y;while(fhq[now].l)now=fhq[now].l;int ans=fhq[now].val;root=merge(x,y);return ans;}};
    FHQT a;
    
    
    

    :::

    :::info[EXBSGS]

    
    namespace BSGS{
    	unordered_map<int,int> mp;
    	int _BSGS(int a,int b,int p,int ad){
    		mp.clear();
    		int m=ceil(sqrt(p)),s=1;
    		For(m){
    			mp[s*b%p]=i;
    			s=s*a%p;
    		}
            int tmp=s;
            s=ad;
    		for(int i=0;i<=m;i++,s=s*tmp%p)if(mp.find(s)!=mp.end())if(i*m-mp[s]>=0) return i*m-mp[s];
    		return -1;
    	}
    	int Q(int a,int b,int p){// a^x=b(mod p)
    		a%=p,b%=p;
    		if(b==1||p==1)return 0;
    		int cnt=0,d,ad=1;
    		while((d=__gcd(a,p))!=1){
    			if(b%d) return -1;
    			cnt++;b/=d;p/=d;
    			ad=(ad*a/d)%p;
    			if(ad==b) return cnt;
    		}
    		int ans=_BSGS(a,b,p,ad);
    		return (ans==-1)?-1:(ans+cnt);
    	}
    };
    

    ::: :::info[线性基]

    struct XXJ{
    	int a[70];
        void clear(){
            m0(a);
        }
    	void Ins(int t){
    		for(int i=60;i>=0;i--){
    			if(!(t>>i))continue;
    			if(!a[i]){a[i]=t;break;}
    			t^=a[i];
    		}
    	}
    	int Max(){
    		int ans=0;
    		for(int i=60;i>=0;i--){
    			ans=max(ans,ans^a[i]);
    		}
    		return ans;
    	}
    }A;
    

    ::: :::info[树链剖分]

    #define mid ((l+r)>>1)
    #define ls (o<<1)
    #define rs (o<<1|1)
    struct XDS{int a[_],p[_],ad[_];int build(int o,int l,int r){if(l==r){return p[o]=a[l];}else{return p[o]=build(ls,l,mid)+build(rs,mid+1,r);}}void psdn(int o,int l,int r){if(ad[o]==0)return;int sm=ad[o];if(l==r){p[o]+=ad[o];ad[o]=0;return;}ad[o]=0;ad[ls]+=sm;p[ls]+=(mid-l+1)*sm;ad[rs]+=sm;p[rs]+=(r-mid)*sm;return;}void add(int o,int l,int r,int x,int y,int sum){if(x<=l&&r<=y){p[o]+=(r-l+1)*sum;ad[o]+=sum;return;}psdn(o,l,r);if(mid>=x)add(ls,l,mid,x,y,sum);if(mid+1<=y)add(rs,mid+1,r,x,y,sum);p[o]=p[ls]+p[rs];return;}int query(int o,int l,int r,int x,int y){if(x<=l&&r<=y){return p[o];}psdn(o,l,r);int anss=0;if(mid>=x)anss+=query(ls,l,mid,x,y);if(mid+1<=y)anss+=query(rs,mid+1,r,x,y);return anss;}};
    #undef mid
    #undef ls
    #undef rs
    struct TREE{int n,R=1,v[_];XDS t;int fa[_],sz[_],dep[_],son[_],top[_],seg[_],rev[_];vector<int>ed[_];void dfs1(int u,int f){sz[u]=1,fa[u]=f,dep[u]=dep[f]+1;for(auto ii:ed[u]){if(ii==f)continue;dfs1(ii,u);sz[u]+=sz[ii];if(sz[ii]>sz[son[u]])son[u]=ii;}}void dfs2(int u,int f){seg[u]=++seg[0];top[u]=f;if(!son[u])return;dfs2(son[u],f);for(auto v:ed[u]){if(v!=fa[u]&&v!=son[u]){dfs2(v,v);}}}int qL(int x,int y){int fx=top[x],fy=top[y],ans=0;while(fx!=fy){if(dep[fx]<dep[fy])swap(x,y),swap(fx,fy);ans+=t.query(1,1,seg[0],seg[fx],seg[x]);x=fa[fx],fx=top[x];}if(dep[x]>dep[y])swap(x,y);ans+=t.query(1,1,seg[0],seg[x],seg[y]);return ans;}int qS(int x){return t.query(1,1,seg[0],seg[x],seg[x]+sz[x]-1);}void uL(int x,int y,int k){while(top[x]!=top[y]){if(dep[top[x]]<dep[top[y]])swap(x,y);t.add(1,1,seg[0],seg[top[x]],seg[x],k);x=fa[top[x]];}if(dep[x]>dep[y])swap(x,y);t.add(1,1,seg[0],seg[x],seg[y],k);}void uS(int x,int k){t.add(1,1,seg[0],seg[x],seg[x]+sz[x]-1,k);}void add(int u,int v){ed[u].push_back(v);ed[v].push_back(u);}void YCL(){dfs1(R,0),dfs2(R,R);FOR(n)t.a[seg[i]]=v[i];t.build(1,1,n);}};
    int n,opt,xx,yy,kk,qw,P;
    TREE T;
    
    

    :::

    :::info[矩阵]

    struct Z{int n,m;int a[M][M];Z(){m0(a)}Z(int ak){n=m=ak;m0(a)}Z(int ak,int bk){n=ak,m=bk;m0(a)}Z operator*(const Z b){if(m!=b.n){cerr<<"exit cant time";exit(255);}Z ans(n,b.m);FOR(n)for(int k=1;k<=m;k++)if(a[i][k]){FORj(b.m){ans.a[i][j]=(ans.a[i][j]+a[i][k]*b.a[k][j]%mod)%mod;}}return ans;}Z operator+(const Z b){if(n!=b.n||m!=b.m){cerr<<"exit cant add";exit(255);}Z ans(n,m);FOR(n)FORj(m)ans.a[i][j]=a[i][j]+b.a[i][j];return ans;}Z operator-(const Z b){if(n!=b.n||m!=b.m){cerr<<"exit cant minus";exit(255);}Z ans(n,m);FOR(n)FORj(m)ans.a[i][j]=a[i][j]-b.a[i][j];return ans;}void input(){FOR(n)FORj(m)cin>>a[i][j];}void print(){FOR(n){FORj(m)cout<<a[i][j]<<' ';ED}}};
    

    ::: :::info[ST 表]

    int n;
    int lg[_],a[_];
    void st_init(){lg[1]=0;for(int i=2;i<_;i++)lg[i]=lg[i>>1]+1;}template<typename T,typename Func>struct ST{ST(Func func):f(func){}T st[_][29];Func f;void build(const T*a){if(!(f(1,1)==1&&f(2,2)==2&&f(3,3)==3)){cerr<<"cant st";exit(0);}for(int i=1;i<=n;i++)st[i][0]=a[i];for(int j=1;j<=lg[n];j++){for(int i=1;i<=n-(1<<j)+1;i++){st[i][j]=f(st[i][j-1],st[i+(1<<(j-1))][j-1]);}}}T Q(int l,int r){int j=lg[r-l+1];return f(st[l][j],st[r-(1<<j)+1][j]);}};int(*MIN)(int,int)=[](int a,int b){return(a+b);};ST<int,decltype(MIN)>mi(MIN);
    
    

    ::: :::info[数学]

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    #define endl "\n"
    #define ER(x) cerr<<#x<<'='<<x<<' ';
    #define ce(x) if(debug){ER(x) ED}
    #define ce2(x,y) if(debug){ER(x) ER(y) ED}
    #define ce3(x,y,z) if(debug){ER(x) ER(y) ER(z) ED}
    #define ce4(x,y,z,w) if(debug){ER(x) ER(y) ER(z) ER(w) ED}
    #define ce5(x,y,z,w,r) if(debug){ER(x) ER(y) ER(z) ER(w) ER(r) ED}
    #define ED cout<<endl;
    #define ci(x) cin>>(x);
    #define ci2(x,y) cin>>(x)>>(y);
    #define ci3(x,y,z) cin>>(x)>>(y)>>(z);
    #define ci4(x,y,z,w) cin>>(x)>>(y)>>(z)>>(w);
    #define ci5(x,y,z,w,r) cin>>(x)>>(y)>>(z)>>(w)>>(r);
    #define cr(x) cout<<(x)<<endl;
    #define cr2(x,y) cout<<(x)<<" "<<(y)<<endl;
    #define cr3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl;
    #define cr4(x,y,z,w) cout<<(x)<<" "<<(y)<<" "<<(z)<<" "<<(w)<<endl;
    #define cr5(x,y,z,w,r) cout<<(x)<<" "<<(y)<<" "<<(z)<<" "<<(w)<<" "<<(r)<<endl;
    #define pi pair<int,int>
    #define fi first
    #define se second
    #define For(n) for(int i=0;i<n;i++)
    #define FOR(n) for(int i=1;i<=n;i++)
    #define Forj(n) for(int j=0;j<n;j++)
    #define FORj(n) for(int j=1;j<=n;j++)
    #define lb(n) (n&-n)
    #define m0(n) memset(n,0,sizeof(n));
    #define fil(n,m) fill(n,n+sizeof(n)/sizeof(int),m);
    #define sz(x) ((int)x.size())
    #define ll int // submit in __int128
    const int MAX_LOG=18+1;//n=1e5
    const int _=(1ll<<(MAX_LOG))+20,mod=998244353,INF=9223372036854775807ll,g=3,Ny=332748118,TEST = 10;
    typedef unsigned long long ull;
    const bool debug = false;
    namespace MATH{
    int F[_], IF[_], PH[_];
    bitset<_>ISP;
    int LIM = 1, L = 0, R[_];
    mt19937 rnd(time(0));
    const int IC = 200000, IS = 0, IP = 200000; //init !len(MAX 5e6) and stirlinglen(MAX 2e3) and isprime&euler (MAX 5e6)
    int Qpow(int b, int a, int md) {
    	int ans = 1, res = b;
    	while (a) {
    		if (a & 1)ans = (ll)ans * res % md;
    		res = (ll)res * res % md;
    		a >>= 1;
    	}
    	return (ans % md + md) % md;
    }
    namespace DXS{
    int LIM=1,L=0,R[_],NOWLIM=-1;
    int roots[2][MAX_LOG+1][1<<MAX_LOG];
    bool rt=0;
    int Inv[(1ll<<MAX_LOG)+10];
    inline int qpow(int b,int a) {
    	int ans=1,res=b;
    	while(a) {
    		if(a&1)ans=ans*res%mod;
    		res=res*res%mod;
    		a>>=1;
    	}
    	return ans;
    }
    
    inline int ny(int a) {
    	return qpow(a,mod-2)%mod;
    }
    
    inline int Z(int a) {
    	return a+(a<0)*mod;
    }
    
    // 多项式基本操作
    using Poly = vector<int>;
    
    inline int deg(const Poly& a) { return (int)a.size() - 1; } // 最高次
    inline void set_deg(Poly& a, int d) { a.resize(d + 1, 0); } // 设置最高次
    inline void trim(Poly& a) { while(a.size() > 1 && a.back() == 0) a.pop_back(); } // 去除高位0
    
    void print(const Poly& a) {
    	For(a.size()) cout << a[i] << ' ';
    	ED
    }
    
    void input(Poly& a) {
    	For(a.size()) ci(a[i])
    }
    inline int add(int a, int b) {
        int s = a + b;
        return s - (s >= mod) * mod;
    }
    inline int mul(int a, int b) {
        return ((ull)a*b)%mod;
    }
    inline void NTT(Poly& a, bool type) {
        int* A = a.data();
        for (int i = 0; i < LIM; ++i)
            if (i < R[i]) swap(A[i], A[R[i]]);
        int log_mid = 1;
        for (int mid = 1; mid < LIM; mid <<= 1, ++log_mid) {
            int* w = roots[type][log_mid];
            int Rt = mid << 1;
            for (int j = 0; j < LIM; j += Rt) {
                int* p1 = A + j;
                int* p2 = A + j + mid;
                for (int k = 0; k < mid; ++k) {
                    int x = p1[k], y = mul(w[k], p2[k]);
                    p1[k] = add(x, y);
                    p2[k] = Z(x-y);
                }
            }
        }
        if (!type) {
            int I = qpow(LIM, mod - 2);
            for (int i = 0; i < LIM; ++i) A[i] = mul(A[i], I);
        }
    }
    inline void initR(int LI) {
    	if(NOWLIM == LI) return;
    	For(LIM) R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
    	NOWLIM=LI;
    }
    
    Poly mul(const Poly& A, const Poly& B) {//乘 
    	while(LIM <= deg(A) + deg(B)) LIM <<= 1, L++;
    	initR(LIM);
    	Poly At(LIM, 0); copy(A.begin(), A.end(), At.begin());
        Poly Bt(LIM, 0); copy(B.begin(), B.end(), Bt.begin());
    	NTT(At, 1), NTT(Bt, 1);
    	For(LIM) At[i] = mul(At[i],Bt[i]);
    	NTT(At, 0);
    	At.resize(deg(A) + deg(B) + 1, 0);
    	trim(At);
    	return At;
    }
    
    Poly ZY(Poly a, int k) { // 左移k位,乘以x^k
    	if(k >= (int)a.size()) return {0};
    	a.erase(a.begin(), a.begin() + k);
    	return a;
    }
    
    Poly YY(Poly a, int k) { // 右移k位,除以x^k
    	a.insert(a.begin(), k, 0);
    	return a;
    }
    
    Poly WEI(Poly a, int d) { // 截断到d次
    	a.resize(d + 1, 0);
    	return a;
    }
    
    Poly add(const Poly& A, const Poly& B) {//加 
    	int mx = max(A.size(), B.size());
    	Poly res(mx);
    	For(mx) {
    		int va = (i < (int)A.size() ? A[i] : 0);
    		int vb = (i < (int)B.size() ? B[i] : 0);
    		res[i] = (va + vb) % mod;
    	}
    	trim(res);
    	return res;
    }
    
    Poly sub(const Poly& A, const Poly& B) {
    	int mx = max(A.size(), B.size());
    	Poly res(mx);
    	For(mx) {
    		int va = (i < (int)A.size() ? A[i] : 0);
    		int vb = (i < (int)B.size() ? B[i] : 0);
    		res[i] = (va - vb + mod) % mod;
    	}
    	trim(res);
    	return res;
    }
    
    Poly inv(const Poly& a) {
    	int n = a.size() - 1; // 最高次
    	Poly ans(1);
    	ans[0] = qpow(a[0], mod - 2);
    	for(int p = 1; p <= n; p <<= 1) {
    		LIM = 1, L = 0;
    		while(LIM <= (p << 1)) LIM <<= 1, L++;
            initR(LIM);
    		Poly tmp(a.begin(), a.begin() + min((int)a.size(), 2 * p));
    		tmp.resize(LIM, 0);
    		ans.resize(LIM, 0);
    		NTT(ans, 1), NTT(tmp, 1);
    		For(LIM) ans[i] =mul(ans[i],Z(2-mul(tmp[i],ans[i])));
    		NTT(ans, 0);
    		ans.resize(2 * p);
    	}
    	ans.resize(n + 1);
    	return ans;
    }
    
    Poly QIUDAO(const Poly& a) {
    	if(a.size() <= 1) return {0};
    	Poly res(a.size() - 1);
    	For(res.size()) res[i] = (i + 1)*a[i + 1]%mod;
    	return res;
    }
    
    Poly JIFEN(const Poly& a) {
    	Poly res(a.size() + 1);
    	res[0] = 0;
    	For(a.size()) res[i + 1] = a[i]*Inv[i+1]%mod;
    	trim(res);
    	return res;
    }
    Poly ln(const Poly& a) {
    	int n = a.size() - 1;
    	Poly tmp = inv(a);
    	Poly tmp2 = QIUDAO(a);
    	Poly ans = mul(tmp, tmp2);
    	ans.resize(n + 1);
    	ans = JIFEN(ans);
    	ans[0] = 0;
    	ans.resize(n + 1);
    	return ans;
    }
    
    Poly exp(const Poly& a) {
    	int n = a.size() - 1;
    	Poly B(1, 1);
    	for(int p = 1; p <= n; p <<= 1) {
    		Poly C = B;
    		C.resize(2 * p);
    		C = ln(C);
    		Poly D(2 * p);
    		For(D.size()) {
    			int va = (i < (int)a.size() ? a[i] : 0);
    			int vc = (i < (int)C.size() ? C[i] : 0);
    			D[i] = Z(va-vc);
    		}
    		D[0] = (D[0] + 1) % mod;
    		B = mul(B, D);
    		B.resize(2 * p);
    	}
    	B.resize(n + 1);
    	return B;
    }
    
    Poly _ksm(Poly a, int k) {
    	a = ln(a);
    	For(a.size()) a[i] = a[i] * k % mod;
    	return exp(a);
    }
    
    Poly ksm(Poly a, int k, int k_ = -1) {
    	int n = a.size() - 1;
    	int W = n;
    	if(k == 0) {
    		Poly res(W + 1, 0);
    		res[0] = 1;
    		return res;
    	}
    	if(k_ == -1) k_ = k;
    	int Ri = -1, X = 0;
    	For(a.size()) if(a[i] != 0) { Ri = i; X = a[i]; break; }
    	if(Ri == -1) return Poly(W + 1, 0);
    	a = ZY(a, Ri);
    	int invX = ny(X);
    	For(a.size()) a[i] = a[i] * invX % mod;
    	a = _ksm(a, k);
    	int powX = qpow(X, k_);
    	For(a.size()) a[i] = a[i] * powX % mod;
    	if(Ri * k > W) return Poly(W + 1, 0);
    	a = YY(a, Ri * k);
    	a.resize(W + 1, 0);
    	return a;
    }
    
    Poly rev(Poly a) {
    	reverse(a.begin(), a.end());
    	return a;
    }
    
    pair<Poly, Poly> div(const Poly& a, const Poly& b) {
    	int n = a.size() - 1, m = b.size() - 1;
    	if(n < m) return {Poly{0}, a};
    	Poly A = rev(a), B = rev(b);
    	B.resize(n - m + 1);
    	A.resize(n - m + 1);
    	B = inv(B);
    	Poly Q = mul(A, B);
    	Q.resize(n - m + 1);
    	Q = rev(Q);
    	Poly R = sub(a, mul(b, Q));
    	trim(Q); trim(R);
    	return {Q, R};
    }
    // 运算符重载
    inline Poly operator+(const Poly& a, const Poly& b) { return add(a, b); }
    inline Poly operator-(const Poly& a, const Poly& b) { return sub(a, b); }
    inline Poly operator*(const Poly& a, const Poly& b) { return mul(a, b); }
    inline Poly operator/(const Poly& a, const Poly& b) { return div(a, b).first; }
    inline Poly operator%(const Poly& a, const Poly& b) { return div(a, b).second; }
    inline Poly operator+(const Poly& a, int k) { Poly res = a; res[0] = (res[0] + k) % mod; return res; }
    inline Poly operator-(const Poly& a, int k) { return a + (-k); }
    inline Poly operator*(const Poly& a, int k) { Poly res = a; For(res.size()) res[i] = res[i] * k % mod; return res; }
    inline Poly operator/(const Poly& a, int k) { return a * ny(k); }
    inline Poly operator<<(const Poly& a, int k) { return ZY(a, k); } // 乘以x^k
    inline Poly operator>>(const Poly& a, int k) { return YY(a, k); } // 除以x^k
    inline Poly operator^(const Poly& a, int k) { return ksm(a, k); }
    };
    using namespace DXS;
    int gcd(int a, int b) {
    	if (a == 0)return b;
    	if (b == 0)return a;
    	int az = __builtin_ctzll(a);
    	int bz = __builtin_ctzll(b);
    	int z = min(az, bz);
    	b >>= bz;
    	while (a) {
    		a >>= az;
    		int diff = a - b;
    		az = __builtin_ctzll(diff);
    		b = min(a, b), a = abs(diff);
    	}
    	return b << z;
    }
    int lcm(int a, int b) {
    	return a / gcd(a, b) * b;
    }
    void INIT(int N) {
    	F[0] = 1;
    	FOR(N)F[i] = F[i - 1] * i % mod;
    	IF[N] = qpow(F[N],mod-2);
    	for (int i = N; i >= 1; i--)IF[i - 1] = IF[i] * i % mod;
    }
    void INIT_S(int N) {
    	return;
    }
    int Ca(int a) {
    	return F[2 * a] * IF[a] % mod * IF[a + 1] % mod;
    }
    int C(int a, int b) {
    	if (b < 0 || b > a)return 0;
    	return F[a] * IF[a - b] % mod * IF[b] % mod;
    }
    int S1(int a, int b) {
    		if (b > a)return 0;
    		if (b == 0)return (a == 0) ? 1 : 0;
    		Poly I1(a), I2(a), I;
    		For(a + 1)I1[i] = 1;
    		I2=I1;
    		I2=ln(I2);
    		I2.resize(a);
    		I = I2 ^ b;
    		For(a + 1)I[i] = I[i] * IF[b] % mod;
    		return F[a] * I[a] % mod;
    }
    int S2(int a, int b) {
    		if (b > a)return 0;
    		if (b == 0)return (a == 0) ? 1 : 0;
    		int ans = 0;
    		For(b + 1) {
    			ans = (ans + ((b - i) % 2 ? -1 : 1) * qpow(i, a) % mod * IF[i] % mod * IF[b - i] % mod) % mod;
    		}
    		return ans;
    }
    bool isp(int K) {
    	if (K <= IP)return ISP[K];
    	if (K < 3 || K % 2 == 0)return K == 2;
    	if (K % 3 == 0)return K == 3;
    	int u = K - 1, t = 0;
    	while (u % 2 == 0)u /= 2, t++;
    	FOR(TEST) {
    		int a = rnd() % (K - 3) + 2, v = Qpow(a, u, K);
    		if (v == 1)continue;
    		int s;
    		for (s = 0; s < t; s++) {
    			if (v == K - 1)break;
    			v = (ll)v * v % K;
    		}
    		if (s == t)return 0;
    	}
    	return 1;
    }
    namespace PO {
    	int ans;
    	map<int, int>mp;
    	int f(int x, int c, int n) {
    		return ((ll)x * x + c) % n;
    	} int P(int N) {
    		if (N % 2 == 0)return 2;
    		if (N % 3 == 0)return 3;
    		int c = rnd() % (N - 1) + 1;
    		int t = f(0, c, N);
    		int r = f(f(0, c, N), c, N);
    		while (t != r) {
    			int d = __gcd(abs(t - r), N);
    			if (d > 1)return d;
    			t = f(t, c, N);
    			r = f(f(r, c, N), c, N);
    		}
    		return N;
    	} void dfs(int n) {
    		if (n == 1)return;
    		if (isp(n)) {
    			mp[n]++;
    			return;
    		}
    		int d = P(n);
    		dfs(d), dfs(n / d);
    	} map<int, int>get(int n) {
    		mp.clear();
    		if (n == 1)return mp;
    		if (isp(n)) {
    			mp[n]++;
    			return mp;
    		}
    		dfs(n);
    		return mp;
    	}
    };
    map<int, int>M;
    int phi(int n) {
    	if (n <= IP)return PH[n];
    	if (n == 1)return 1;
    	M = PO::get(n);
    	int res = n;
    	for (auto I : M) {
    		res = res / I.first * (I.first - 1);
    	}
    	return res;
    }
    void INIT_P(int N) {
    	FOR(N)PH[i] = i;
    	for (int i = 2; i <= N; i++) {
    		if (PH[i] == i) {
    			ISP[i] = 1;
    			for (int j = i; j <= N; j += i) {
    				PH[j] = PH[j] / i * (i - 1);
    			}
    		}
    	}
    	ISP[0] = 0;
    }
    bool init() {
    	for(int K=0;K<=1;K++){FOR(MAX_LOG){int len=1<<i;int wn=qpow(K?g:Ny,(mod-1)/len);roots[K][i][0]=1;Forj(len-1)roots[K][i][j+1]=roots[K][i][j]*wn%mod;}}
    	Inv[1] = 1;for (int i = 2; i <= 1ll<<MAX_LOG; ++i)Inv[i] =(mod - mod / i)*(Inv[mod % i])%mod;
    	if (IC != 0)INIT(IC);
    	if (IS != 0)INIT_S(IS);
    	if (IP != 0)INIT_P(IP);
    	return 1;
    }
    //Ca(a):catalan  b>a:C(a,b) S1(a,b),S2(a,b),phi(a)
    int n, x, y, ans, a, b;
    namespace CRT {
    	int N, A[_], B[_];
    	ll n, x, y;
    	ll a[_], b[_];
    	ll lcm(ll ak, ll bk) {
    		return ak / __gcd(ak, bk) * bk;
    	} ll exgcd(ll a, ll b, ll&x, ll&y) {
    		if (b == 0) {
    			x = 1;
    			y = 0;
    			return a;
    		}
    		ll d = exgcd(b, a % b, x, y);
    		ll t = x;
    		x = y;
    		y = t - a / b * y;
    		return d;
    	} ll crt() {
    		n = N;
    		FOR(N)a[i] = A[i], b[i] = B[i];
    		ll aa = 1, bb = 0;
    		FOR(n) {
    			ll A = a[i], B = b[i];
    			ll d = exgcd(aa, A, x, y);
    			x = (bb - B) / d * x;
    			bb -= aa * x;
    			aa = A / d * aa;
    			bb = (bb % aa + aa) % aa;
    		}
    		return (bb + aa) % aa;
    	}
    };
    //cin>>CRT::N and N x=B1(mod A1)
    namespace BSGS {
    	unordered_map<int, int>mp;
    	int _BSGS(int a, int b, int p, int ad) {
    		mp.clear();
    		int m = ceil(sqrt(p)), s = 1;
    		For(m) {
    			mp[s * b % p] = i;
    			s = s * a % p;
    		}
    		int tmp = s;
    		s = ad;
    		for (int i = 0; i <= m; i++, s = s * tmp % p)if (mp.find(s) != mp.end())if (i * m - mp[s] >= 0)return i * m - mp[s];
    		return -1;
    	} int Q(int a, int b, int p) {
    		a %= p, b %= p;
    		if (b == 1 || p == 1)return 0;
    		int cnt = 0, d, ad = 1;
    		while ((d = __gcd(a, p)) != 1) {
    			if (b % d)return -1;
    			cnt++;
    			b /= d;
    			p /= d;
    			ad = (ad * a / d) % p;
    			if (ad == b)return cnt;
    		}
    		int ans = _BSGS(a, b, p, ad);
    		return (ans == -1) ? -1 : (ans + cnt);
    	}
    };
    // Q(a,b,p): a^x=b(mod p)
    };
    using namespace MATH;
    void PBSakioi() {
    	ci2(a, b)
    	cr5(Ca(a), phi(a), C(a, b), S1(a, b), S2(a, b))
    	cr2(gcd(a, b), lcm(a, b))
    }
    signed main() {
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    	init();
    	PBSakioi();
    }
    //100000 20000 20000
    

    :::

  • 通过的题目

  • 最近活动

  • 最近编写的题解

题目标签

输入
1
输出
1