~/algor $ cat problems/kombinatorika-tartibsizliklar
Nobody in their place
Medium
1000 ms
128 MB
58%
$n$ students handed in their notebooks. The teacher handed the notebooks back, one to each student, but no student got their own notebook. Find the number of ways this could happen.
Input
One positive integer $n$.
Output
One integer — the number of ways modulo $10^{9} + 7$.
Note
$1 \le n \le 10^{6}$
Examples
Input #1
3
Output #1
2
Input #2
4
Output #2
9