n,k = map(int, input().split()) print(n*(n-1)//2%998244353)