#C5197. Beautiful Arrangements

    ID: 48819 Type: Default 1000ms 256MiB

Beautiful Arrangements

Beautiful Arrangements

Given an integer (N) representing the length of a garden, determine the number of beautiful arrangements of flowers. A beautiful arrangement is defined as follows:

  • For (N = 1), no arrangement is possible (the answer is 0).
  • For (N = 2), there are exactly 2 arrangements.
  • For (N \ge 3), the number of beautiful arrangements is given by the formula:

[ A(N)=\prod_{i=2}^{N} i \mod (10^9+7), ]

You are required to compute (A(N)) and output the result.

inputFormat

The input consists of a single integer (N) (where (1 \leq N \leq 10^6)) representing the garden length.

outputFormat

Output a single integer, the number of beautiful arrangements modulo (10^9+7).## sample

1
0

</p>