import sys input = sys.stdin.readline mod=998244353 N=int(input()) print(N*(N-1)%mod)