Let $n$ be an integer. Consider all permutations on integers $1$ to $n$ in lexicographic order, and concatenate them into one big sequence $P$. For example, if $n = 3$, then $P = [1, 2, 3, 1, 3, 2, 2, 1, 3, 2, 3, 1, 3, 1, 2, 3, 2, 1]$. The length of this sequence is $n \cdot n!$.

Let $1 \leq i \leq j \leq n \cdot n!$ be a pair of indices. We call the sequence $(P_i, P_{i+1}, \dots, P_{j-1}, P_j)$ a subarray of $P$. 

You are given $n$. Find the number of distinct subarrays of $P$. Since this number may be large, output it modulo $998244353$ (a prime number). 


-----Input-----

The only line contains one integer $n$ ($1 \leq n \leq 10^6$), as described in the problem statement.


-----Output-----

Output a single integer — the number of distinct subarrays, modulo $998244353$.


-----Examples-----
Input
2

Output
8

Input
10

Output
19210869



-----Note-----

In the first example, the sequence $P = [1, 2, 2, 1]$. It has eight distinct subarrays: $[1]$, $[2]$, $[1, 2]$, $[2, 1]$, $[2, 2]$, $[1, 2, 2]$, $[2, 2, 1]$ and $[1, 2, 2, 1]$.

Difficulty: interview

Starter code:

Solutions:
'''
// There are n! / (i+1)! * i permutations with decreasing seq length i (i+1 changes) for i <= n!
// There are n! / (i+1)! permutations for each 1 <= j <= i of position of moved one

// All nonempty things
+ n*n! * (n*n! + 1) / 2

// Subtract off everything inside one of them
- n! * n * (n+1) / 2

// Subtract off everything that doesn't include the min-incr
- sum_{perm i,j} n * (n-i)

// We're left with all words that include at least last of prv -> min-incr, which all have at least one match

// No matches
+ sum_{i=1..n} n!/(n-i)!

// First match is dist N, doesn't include anything
// aaa....aaa -> middle part can't all be decreasing
+ sum_{i=1..n} n! - n!/(n-i)!

// First match is dist N, includes subst
// aaabxyc   aaac
// Everything decreasing xycb
+ sum_{i=1..n-1} n!/(i+1)! * (n-i-1)

// First match is dist N, includes min-incr -> is unique, already counted

// First match is < N -> either came from min-incr or from subst
// You can distinguish because match..match includes everything smaller or everything smaller minus one of them
// Ending at min-incr gives unique thing

// How many distinct things end at subst?
// Ending at subst:   (b ijk ) lmn c xyz  ... c such that zyxbcnmlkji are sorted leftovers
                   or   b ijk lmn c xyz .... c
// Might as well not include xyz
+ sum_{i=1..n-1} n!/(i+1)! * (i+1)

// Simplified claim:
if it includes min-incr, then it's always unique;
if it includes subst, only count if it came from the end (j = 1) (in which case it always matches)
otherwise, it's just some delta-N match or it's all distinct

n*n! * (n*n! + 1) / 2
- n! * n * (n+1) / 2
- sum_{i=1..n-1} n! / (i+1)! * i * n * (n-i)
+ sum_{i=1..n} n! / (n-i)!
+ sum_{i=1..n} n! - n! / (n-i)!
+ sum_{i=1..n-1} n! / (i+1)! * n

= n*n! * (n*n! + 1) / 2
- n! * n * (n+1) / 2
- sum_{i=1..n-1} n! / (i+1)! * n * (i * (n-i) - 1)
+ n * n!

= n*n! * (n*n! - n + 2) / 2
- sum_{i=1..n-1} n! / (i+1)! * n * (i * (n-i) - 1)
'''

def fact(n):
    res = 1
    for i in range(1,n+1):
        res *= i
    return res

def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans

#print(f(int(input())) % 998244353)

def g(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2

print(g(int(input())))


M,a=998244353,0
p=n=int(input())
for i in range(n-1):a,p=(a+p*(n-i-1)*(i+1)-p)%M,p*(n-i)%M
a=(p*(p-n+2)-a-a)%M
if a&1:a+=M
print(a//2)

M,a=998244353,0
p=n=int(input())
for i in range(n-1):a,p=(a+p*(n-i-1)*(i+1)-p)%M,p*(n-i)%M
a=(p*(p-n+2)-a-a)%M
if a&1:a+=M
print(a//2)


def fact(n):
    res = 1
    for i in range(1,n+1):
        res *= i
    return res
 
def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans
 
#print(f(int(input())) % 998244353)
 
def g(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2
 
print(g(int(input())))


def fact(n):
    rest = 1
    for i in range(1,n+1):
        rest *= i
    return rest
 
def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans
 
#print(f(int(input())) % 998244353)
 
def g(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2
 
print(g(int(input())))


def fact(n):
    resq = 1
    for i in range(1,n+1):
        resq *= i
    return resq
 
def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans
 
#print(f(int(input())) % 998244353)
 
def g(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2
 
print(g(int(input())))


M,a=998244353,0
p=n=int(input())
for i in range(n-1):a,p=(a+p*(n-i-1)*(i+1)-p)%M,p*(n-i)%M
a=(p*(p-n+2)-a-a)%M
if a&1:a+=M
print(a//2)
t=0


def fact(n):
    resq = 1
    for i in range(1,n+1):
        resq *= i
    return resq
 
def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans
 
#purvikaurraina
#print(f(int(input())) % 998244353)
 
def g(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2
 
print(g(int(input())))
	 		


def fact(n):
    re = 1
    for i in range(1,n+1):
        re *= i
    return re
 
def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans
 
#print(f(int(input())) % 998244353)
 
def g(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2
 
print(g(int(input())))


def fact(n):
    resq = 1
    for i in range(1,n+1):
        resq *= i
    return resq
 
def f(n):
    l = fact(n) * n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= fact(n) // fact(i+1) * n * (i * (n-i) - 1)
    return ans
  
def g(n):
    M = 998244353
    p = n
    a = 0
    for j in range(n,1,-1):
        a=(a+p*(j-1)*(n-j+1)-p)%M
        p=p*j%M
    a=(p*(p-n+2)-a-a)%M
    if a&1:a+=M
    return a//2
 
print(g(int(input())))
	 		
			    		 				     	   	    	


import math
def f(n):
    l = math.factorial(n)*n
    ans = l * (l-n+2) // 2
    for i in range(1,n):
        ans -= math.factorial(n)//math.factorial(i+1)*n*(i*(n-i)-1)
    return ans

def solve(n):
    M = 998244353
    p = n
    a = 0
    for i in range(n,1,-1):
        a=(a+p*(i-1)*(n-i+1)-p)%M
        p=p*i%M
    a = (p*(p-n+2)-2*a)%M
    if a&1:a+=M
    return a//2

x = int(input())
ans = solve(x)
print(ans)