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