using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (h, w) = (c[0], c[1]);
        WriteLine(Game(h, w));
    }
    static long Game(long h, long w)
    {
        var mod = 998_244_353;
        var h2 = h / 2 + 1;
        var w2 = w / 2 + 1;
        var res = (h2 - 1) * (w2 - 1) % mod * ((h2 * w2 % mod + h2 * 2 + w2 * 2) % mod) % mod;
        if (h % 2 == 1) res = (res + w / 2 * (w / 2 + 1) % mod) % mod;
        if (w % 2 == 1) res = (res + h / 2 * (h / 2 + 1) % mod) % mod;
        var all = h * w % mod * ((h * w - 1) % mod) % mod;
        return (all - res + mod) % mod;
    }
}