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