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

#SP0000008. Số nguyên tố hay hợp số (Prime or not Prime!)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số nguyên tố hay hợp số (Prime or not Prime!)

Prime or not Prime!

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

You are given an integer n≥2n\ge2. A prime is a positive integer with exactly two positive divisors, 11 and itself. Every other integer at least 22 is composite. Determine which type nn belongs to.

Input

One line containing integer nn.

Output

Print YES if nn is prime, and NO otherwise. Use uppercase letters.

Subtasks

  • Subtask 1 (20 points): 2≤n≤10002\le n\le 1000.
  • Subtask 2 (30 points): 2≤n≤10000002\le n\le 1000000.
  • Subtask 3 (50 points): 2≤n≤10000000002\le n\le 1000000000.

Examples

Input

127

Output

YES

Explanation

127127 is not divisible by any of 2,3,5,7,112,3,5,7,11, which are all primes not exceeding 127\sqrt{127}. Hence it is prime and the output is YES.

Input

513

Output

NO

Explanation

The digit sum of 513513 is 99, so 513513 is divisible by 33 and is composite. Print NO.