Problem:
Score : 900 points

Problem Statement

We have a sequence of N integers: x=(x_0,x_1,\cdots,x_{N-1}).
Initially, x_i=0 for each i (0 \leq i \leq N-1).

Snuke will perform the following operation exactly M times:

Choose two distinct indices i, j (0 \leq i,j \leq N-1,\ i \neq j).
Then, replace x_i with x_i+2 and x_j with x_j+1.

Find the number of different sequences that can result after M operations.
Since it can be enormous, compute the count modulo 998244353.

Constraints

2 \leq N \leq 10^6

1 \leq M \leq 5 \times 10^5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of different sequences that can result after M operations, modulo 998244353.

Sample Input 1

2 2

Sample Output 1

3

After two operations, there are three possible outcomes:

x=(2,4)

x=(3,3)

x=(4,2)

For example, x=(3,3) can result after the following sequence of operations:

First, choose i=0,j=1, changing x from (0,0) to (2,1).

Second, choose i=1,j=0, changing x from (2,1) to (3,3).

Sample Input 2

3 2

Sample Output 2

19

Sample Input 3

10 10

Sample Output 3

211428932

Sample Input 4

100000 50000

Sample Output 4

3463133

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef pair<lint, pii> plp;
typedef complex<double> xy_t;
typedef vector<lint> poly;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

const lint mod = 998244353;
const lint INF = mod*mod;
const int MAX = 2e6;

lint powmod(lint x, lint n){
    lint ret = 1;
    while(n > 0){
        if(n&1) ret *= x, ret %= mod, n -= 1;
        else x *= x, x %= mod, n >>= 1;
    }
    return ret;
}

vector<lint> fact;
vector<lint> revfact;

void setfact(int n){
    fact.resize(n+1); revfact.resize(n+1);
    fact[0] = 1;
    rep(i, n) fact[i+1] = fact[i] * (i+1) % mod;

    revfact[n] = powmod(fact[n], mod-2);
    for(int i=n-1; i>=0; i--) revfact[i] = revfact[i+1] * (i+1) % mod;
}

lint getC(int n, int r){
    if(n<r) return 0;
    return fact[n] * revfact[r] % mod * revfact[n-r] % mod;
}

lint part(int n, int K){
    return getC(n+K-1, K-1);
}

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    setfact(MAX);
    lint ans=0;
    rep(i, min(m+1, n+1))if((3*m-i)%2==0){
        ans+=getC(n, i)*part((3*m-i)/2, n)%mod;
        ans%=mod;
    }
    rep(i, min(m+1, n+1))if((m-i)%2==0){
        lint tmp=getC(n-1, i)*part((m-i)/2, n-1)%mod;
        tmp=(tmp-getC(n, i)*part((m-i)/2, n)%mod+mod)%mod;
        (tmp*=(lint)n)%=mod;
        (ans+=tmp)%=mod;
    }
    printf("%lld\n", ans);
}