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# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;


class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        setFact(600000 * 3);

        int N = cin.nextInt();
        int M = cin.nextInt();

        long sum = 0;
        for (int i = M % 2; i <= Math.Min(N, M); i += 2)
        {
            long tmp = getC(N, i);
            int nokori = (3 * M - i) / 2;
            long add = tmp * getC(nokori + N - 1, N - 1);
            add %= mod;
            sum += add;
            sum %= mod;
        }


        for (int i = 2 * M + 1; i <= 3 * M; i++)
        {
            int nokori = 3 * M - i;
            long add = getC(nokori + N - 2, N - 2);
            add *= N;
            add %= mod;

            sum -= add;
   
            if (sum < 0) sum += mod;
        }
        Console.WriteLine(sum);
    }


    long mod = 998244353;

    long powmod(long a, long p)
    {
        long ans = 1;
        long mul = a;
        for (; p > 0; p >>= 1, mul = (mul * mul) % mod)
        {
            if ((p & 1) == 1) ans = (ans * mul) % mod;
        }
        return ans;
    }


    long[] fact; //階乗
    long[] revFact; //階乗の逆元
    void setFact(int N)
    {
        fact = new long[N];
        revFact = new long[N];
        fact[0] = 1;
        for (int i = 1; i < N; i++)
        {
            fact[i] = fact[i - 1] * i;
            fact[i] %= mod;
        }
        revFact[N - 1] = powmod(fact[N - 1], mod - 2);
        for (int i = N - 2; i >= 0; i--)
        {
            revFact[i] = revFact[i + 1] * (i + 1);
            revFact[i] %= mod;
        }
    }

    long getC(int a, int b)
    {
        return (((fact[a] * revFact[b]) % mod) * revFact[a - b]) % mod;
    }


}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}