A permutation of N integers from 1 to N is an array where each number has appeared exactly once in the array. The array [1,3,2,5,4] is a permutation of 5 numbers. For any array of size N, there are N factorial permutations in total.
We define perplexity as the sum of absolute difference between the adjacent elements of an array. For example, the array [1,3,2] has the total perplexity of 3.
In this problem, you will be given N, you will have to answer the sum of perplexity of all the permutations of 1 to N.
The only line of input contains an integer N (≤105), the size of the array.
Output one number, the total sum of perplexities across all the permutations of 1 to N. Since the result can be very large, print the remainder of the result, when divided with 100007.
Input | Output |
---|---|
2 | 2 |