import math a=0 n,m=map(int,input().split()) for i in range(n*m):a+=math.lcm(i//m+1,i%m+1) print(a%998244353)