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

#SP0000263. Nguyên tố hay không (Prime or Not)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Nguyên tố hay không (Prime or Not)

Prime or Not

Source: SPOJ

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): 2≤N≤100002\le N\le 10000.
  • Subtask 2 (30 points): 2≤N≤1092\le N\le 10^9.
  • Subtask 3 (50 points): 2≤N≤263−12\le N\le 2^{63}-1.

Examples

Example 1

Input

2

Output

YES

Explanation

22 is the only even prime; print YES.

Example 2

Input

4

Output

NO

Explanation

4=2⋅24=2\cdot2 is composite, so print NO.

Example 3

Input

3215031751

Output

NO

Explanation

3215031751=151⋅751⋅283513215031751=151\cdot751\cdot28351 is composite; weak primality tests may be fooled, but the correct output is NO.