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

#SP0000171. Số siêu nguyên tố

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số siêu nguyên tố

Superprime

Source: LQDOJ superprime
Version: Phuoc Hung OJ Extended (one dataset per execution; batched queries remain together).

Problem Statement

A positive integer NN is a superprime if NN is prime and its last decimal digit is also prime. For example, 1313 is a superprime because both 1313 and 33 are prime.

Input

One positive integer NN.

Output

Print YES for a superprime and NO otherwise.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1031\le N\le 10^3.
  • Subtask 2 (30 points): 1≤N≤1061\le N\le 10^6.
  • Subtask 3 (50 points): 1≤N≤2⋅1091\le N\le 2\cdot10^9.

Sample Input

13

Sample Output

YES

Sample Explanation

1313 is prime, and its last decimal digit 33 is also prime.