TopCoder

User's AC Ratio

100.0% (1/1)

Submission's AC Ratio

16.7% (1/6)

Tags

Description

The positive integer n is given. It is known that n = p * q, where p and q are primes,
p <= q and |q - kp| <=105 for some given positive integer k. You must find p and q.

Input Format

Each line contains integers n (1 < n < 10120) and k (0 < k < 108).

Output Format

For each pair of numbers n and k print in separate line the product p * q such that p <= q.

Sample Input 1

35 1
121 1
1000730021 9

Sample Output 1

5 * 7
11 * 11
10007 * 100003

Hints

Problem Source

Migrated from old NTUJ.

SEERC 2009 pA

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200