import java.util.Scanner; import java.util.stream.IntStream; public class Main{ static IntStream REPS(int v){return IntStream.range(0,v);} static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);} static IntStream INS(int n) {return REPS(n).map(i->getInt());} static Scanner s=new Scanner(System.in); static int getInt(){return Integer.parseInt(s.next());} public static void main(String[]$){ int n=getInt(),mod=1000000007; long sum[]={0,1}; if(n==1) { System.out.println(1); return; } for(int i=1;i<=n;++i) { long v=(sum[(i+1)%2]*i)%mod; sum[i%2]=(sum[i%2]+v)%mod; if(i==n)System.out.println(v); } } }