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