n=int(input()) R={1:1,2:2,3:6,4:28} def f(x): if x==1:return 1 if x<=3:k=R[x-1] else:k=R[x-2]//(x-2)+R[x-1] R[x]=k*x return R[x] for i in range(1,n):f(i) # print(i,f(i)) print(f(n)%(10**9+7))