Limits 1s, 512 MB

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.

Input

The only line of input contains an integer N (≤105), the size of the array.

Output

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.

Sample

InputOutput
2
2

Submit

Login to submit.

Contributors

Statistics

64% Solution Ratio
fsshakkhorEarliest, Mar '20
nusuBotFastest, 0.0s
fsshakkhorLightest, 131 kB
MursaleenShortest, 461B
Toph uses cookies. By continuing you agree to our Cookie Policy.