import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) MOD = 10**9 + 7 U = 10 ** 5 A = [0] * (U+1) A[1] = 1 cum1 = 0 cum2 = 1 for x in range(2,U+1): cum1, cum2 = cum2, cum1 A[x] = x * cum1 % MOD cum2 += A[x] print(A[N])