n = int(input()) print(n*(n-1)//2%998244353)