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

#SP0000262. Kiểm tra số nguyên tố 64-bit (Primality Test)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Kiểm tra số nguyên tố 64-bit (Primality Test)

Primality Test

Source: Library Checker

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer NN, determine whether NN is prime. A prime integer is greater than 11 and has exactly two positive divisors: 11 and itself. In particular, 11 is not prime.

Input

One line containing the integer NN.

Output

Print exactly one word: Yes if NN is prime, otherwise No.

Subtasks

  • Subtask 1 (20 points): 1≤N≤100001\le N\le 10000.
  • Subtask 2 (30 points): 1≤N≤1091\le N\le 10^9.
  • Subtask 3 (50 points): 1≤N≤10181\le N\le 10^{18}.

Examples

Example 1

Input

1

Output

No

Explanation

11 is not prime because a prime must exceed 11, so print No.

Example 2

Input

2

Output

Yes

Explanation

22 has exactly two positive divisors, 11 and 22, so print Yes.

Example 3

Input

341

Output

No

Explanation

341=11⋅31341=11\cdot31 is composite even though it is a base-22 pseudoprime, so print No.

Example 4

Input

998244353

Output

Yes

Explanation

998244353998244353 is prime, so the deterministic primality test accepts it and prints Yes.