#C1628. Beautiful Permutations

    ID: 44854 Type: Default 1000ms 256MiB

Beautiful Permutations

Beautiful Permutations

You are given a single integer n representing the number of elements from 1 to n. A permutation of these n integers is called beautiful if the sum of absolute differences between consecutive elements is even. In other words, if P = [p1, p2, ..., pn] is a permutation, it is beautiful if

$$\sum_{i=1}^{n-1} |p_{i+1} - p_i| \equiv 0 \pmod{2}. $$

It can be proven that the number of beautiful permutations of n elements is given by:

  • If n is odd, the answer is n!.
  • If n is even, the answer is \(\frac{n!}{2}\).

Since the answer can be very large, output it modulo \(10^9+7\). Use modular arithmetic for computing factorials and for division (when n is even) compute the division using modular inverse.

inputFormat

The input is read from stdin and consists of a single integer n (1 ≤ n ≤ 105).

outputFormat

Output the number of beautiful permutations modulo \(10^9+7\> to stdout.

## sample
1
1

</p>