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

#SP0000013. Lặp lại một số (Simple Repetition)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Lặp lại một số (Simple Repetition)

Simple Repetition

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Pasha constructs an integer yy by concatenating the decimal representation of positive integer xx exactly kk times, with no separators or leading zeroes. For instance, x=52x=52 and k=3k=3 produce y=525252y=525252. Determine whether yy is prime. The constructed integer may be very large and need not be printed.

Input

One line containing two integers xx and kk, in that order.

Output

Print YES if yy is prime, or NO otherwise.

Subtasks

  • Subtask 1 (20 points): 1≤x≤1001\le x\le 100, 1≤k≤31\le k\le 3.
  • Subtask 2 (30 points): 1≤x≤10000001\le x\le 1000000, 1≤k≤51\le k\le 5.
  • Subtask 3 (50 points): 1≤x≤10000000001\le x\le 1000000000, 1≤k≤71\le k\le 7.

Examples

Input

52 3

Output

NO

Explanation

Concatenating 52 three times gives 525252525252, an even integer greater than 22. It is composite; print NO.

Input

7 1

Output

YES

Explanation

With k=1k=1, the new number equals x=7x=7, which is prime. Print YES.

Input

1 2

Output

YES

Explanation

Repeating 1 twice yields y=11y=11, a prime, so print YES.

Input

1 7

Output

NO

Explanation

Repeating 1 seven times gives 1111111=239⋅46491111111=239\cdot4649, so the number is composite and the answer is NO.