PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000172. Giai thừa và bội số (Factorial and Multiple)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Giai thừa và bội số (Factorial and Multiple)

Factorial and Multiple

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer KK, define the factorial of a positive integer NN as

N!=1⋅2⋯N.N!=1\cdot2\cdots N.

An integer NN is valid when KK divides N!N!, i.e. N!=KqN!=Kq for some integer qq. Find the smallest positive integer NN for which this holds. A solution is guaranteed to exist.

Print NN, not N!N!. The factorial itself may be too large to represent directly.

Input

One line containing the integer KK.

Output

Print the smallest positive integer NN satisfying K∣N!K\mid N!.

Subtasks

  • Subtask 1 (20 points): 2≤K≤1062 \le K \le 10^6.
  • Subtask 2 (30 points): 2≤K≤1092 \le K \le 10^9.
  • Subtask 3 (50 points): 2≤K≤10122 \le K \le 10^{12}.

Examples

Example 1

Input

30

Output

5

Explanation

4!=244!=24 is not divisible by 3030, whereas 5!=120=30⋅45!=120=30\cdot4. Thus the minimum is 55.

Example 2

Input

280

Output

7

Explanation

6!=7206!=720 is not divisible by 280280, but 7!=5040=280⋅187!=5040=280\cdot18, so the answer is 77.