Discrete Logarithm is a Joke

아직 제출이 없습니다시간 제한10초메모리 제한256 MB

문제

M=1018+31M = 10^{18} + 31 is a prime number. g=42g = 42 is a primitive root modulo MM, which means that g1modM,g2modM,,gM1modMg^{1} \bmod M, g^{2} \bmod M, \ldots, g^{M-1} \bmod M are all distinct integers from \[1;M)\[1; M). Let's define a function f(x)f(x) as the smallest positive integer pp such that gp=xmodMg^{p} = x \bmod M. ff is a bijection from \[1;M)\[1; M) to \[1;M)\[1; M).

Let's then define a sequence of numbers as follows:

  • a_0=960,002,411,612,632,915a\_{0} = 960\\,002\\,411\\,612\\,632\\,915 (you can copy this number from the sample);
  • a_i+1=f(a_i)a\_{i + 1} = f(a\_{i}).

Given nn, find a_na\_{n}.

입력

The only line of input contains one integer nn (0n1060 \le n \le 10^{6}).

출력

Print a_na\_{n}.