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