Wilson

Given an integer N, compute the value of (N-1)! mod N.

Input

N, on a single line.

Output

The value of the expression, on a single line.

Constraints

  • 2 ≤ N ≤ 109
  • You will receive full feedback for this problem.

Samples

InputOutputExplanation
42N = 4
(N-1)! = (4-1)! = 3! = 6
6 mod 4 = 2
420
Questions?

Sponsors Gold