N=int(input()) M=10**9+7 p=[0,1,1]+[2]*N for i in range(3,N): p[i+1]=(p[i]*i+p[i-1])%M print(p[N]*N%M)