import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static final long MOD = 1000000007l; public static long mod_pow(long a, long e, long m){ long ret = 1; for(; e > 0; e /= 2){ if (e % 2 != 0) ret = (ret * a) % m; a = (a * a) % m; } return ret; } public static long mod_inv(long a, long p){ return mod_pow(a, p - 2, p); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final long N = sc.nextLong(); if(N >= MOD){ System.out.println(0); return; } if(N < MOD / 2){ long answer = 1; for(int i = 2; i <= N; i++){ answer *= i; answer %= MOD; } System.out.println(answer); }else{ long answer = MOD - 1; for(long i = MOD - 1; i > N; i--){ answer *= mod_inv(i, MOD); answer %= MOD; } System.out.println(answer); } } }