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

#GL0000336. Madoka và ngôi trường tốt nhất nước Nga (Madoka and the Best School in Russia)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Madoka và ngôi trường tốt nhất nước Nga (Madoka and the Best School in Russia)

Madoka and the Best School in Russia

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers x,dx,d with d∣xd\mid x:

  • A positive integer is good if it is divisible by dd.
  • A number is beautiful if it is good but cannot be written as the product of two good integers.

Determine whether xx admits at least two distinct factorizations into one or more beautiful numbers. The factor order is irrelevant: two factorizations with the same multiset of factors are identical.

For example, x=36,d=2x=36,d=2 has distinct beautiful factorizations 2⋅182\cdot18 and 6⋅66\cdot6.

Each PHOJ input file contains one case (the initial test count in the original Codeforces problem is omitted).

Input

One line containing the integers x,dx,d satisfying d∣xd\mid x.

Output

Print YES if there are at least two distinct beautiful-factor multisets; otherwise print NO.

Subtasks

  • Subtask 1 (20 points): 2≤d≤x≤1042\le d\le x\le 10^4, d∣xd\mid x.

  • Subtask 2 (30 points): 2≤d≤x≤1062\le d\le x\le 10^6, d∣xd\mid x.

  • Subtask 3 (50 points): 2≤d≤x≤1092\le d\le x\le 10^9, d∣xd\mid x.

Examples

Example 1

Input

6 2

Output

NO

Explanation

6 has only one beautiful-factor multiset: [6].

Example 2

Input

36 2

Output

YES

Explanation

Two different multisets exist: 18×2 and 6×6; every factor is divisible by 2 but not by 4.

Example 3

Input

1000 10

Output

YES

Explanation

1000=10×10×10 and 1000=20×50; all factors in both decompositions are beautiful.

Example 4

Input

128 4

Output

NO

Explanation

The only valid multiset is 4×4×8. The factor 16 is not beautiful because 16=4×4.