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

#SP0000084. Ước nguyên tố nhỏ nhất (Least prime divisor)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Ước nguyên tố nhỏ nhất (Least prime divisor)

Least prime divisor

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given an odd integer n>2n>2, find its smallest prime divisor. If nn is prime, then its smallest prime divisor is nn itself. For example, 49=7249=7^2, so the answer is 77.

Input

One line contains the odd integer nn.

Output

Print the smallest prime divisor of nn.

Subtasks

  • Subtask 1 (20 points): 3≤n≤9993\le n\le 999; the integer nn is odd.
  • Subtask 2 (30 points): 3≤n≤9999993\le n\le 999999; the integer nn is odd.
  • Subtask 3 (50 points): 3≤n≤999999993\le n\le 99999999; the integer nn is odd.

Examples

Input

49

Output

7

Explanation

The number 4949 is odd and greater than 22. Since 49=7⋅749=7\cdot7 and none of the smaller primes 2,3,52,3,5 divides 4949, its smallest prime divisor is 77. Print 7.