#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) ((int)(x).size()) #define pb push_back using ll = long long; using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b fac(500000), finv(500000), inv(500000); void initcom(){ fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1; for(int i=2; i<500000; i++){ fac[i] = (fac[i-1]*i) % mod; inv[i] = mod - inv[mod%i] * (mod/i) % mod; finv[i] = finv[i-1] * inv[i] % mod; } } ll nCr(int n, int k){ if(n> H >> W; initcom(); vector A(H+1,0); vector B(W+1,0); for(int i=1;i<=H;i++){ A[i] = nCr(i,2*i-H)*finv[i]%mod; } for(int i=1;i<=W;i++){ B[i] = nCr(i,2*i-W)*finv[i]%mod; } auto C = atcoder::convolution(A,B); ll ans = 0; for(int i=1;i