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

#SP0000074. Số kỳ lạ (Strange Number)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số kỳ lạ (Strange Number)

Strange Number

Source: CodeChef

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers X,KX,K, determine whether there exists a positive integer AA with exactly XX positive divisors, exactly KK of which are prime numbers. For instance, A=6A=6 has four positive divisors 1,2,3,61,2,3,6 and exactly two prime divisors 2,32,3. You only need to decide existence; you need not construct AA.

Input

One line contains positive integers XX and KK.

Output

Print 1 if such an integer AA exists; otherwise print 0.

Subtasks

  • Subtask 1 (20 points): 1≤X≤10001\le X\le 1000; 1≤K≤1091\le K\le10^9.
  • Subtask 2 (30 points): 1≤X≤10000001\le X\le 1000000; 1≤K≤1091\le K\le10^9.
  • Subtask 3 (50 points): 1≤X≤10000000001\le X\le 1000000000; 1≤K≤1091\le K\le10^9.

Examples

Input

4 2

Output

1

Explanation

Choose A=6A=6. Its positive divisors are 1,2,3,61,2,3,6, exactly X=4X=4 values; the prime divisors are 22 and 33, exactly K=2K=2. Such an integer exists, so print 1.