RSA Factorization

Time limit1sMemory limit128 MB

Summary
Given a huge n up to 10^120 and k, find primes p ≤ q with n = p*q and |q - kp| bounded by 10^5, requiring advanced factorization insight.
Level

Hard9 of 10

Topics
Number theory, Math, Binary search
Solved
No attempts yet

Problem

Given positive integers nn and kk, write a program that finds prime numbers pp and qq such that n=p×qn = p \times q, p≤qp \le q, and ∣q−kp∣≤105|q - kp| \le 10^5.

Input

The first line contains nn and kk (1<n<101201 < n < 10^{120}, 1<k<1081 < k < 10^8).

Output

On the first line, print the prime numbers pp and qq that satisfy the conditions, in the form p * q.

Examples1

  1. Example 1

    Input
    35 1
    
    Expected output
    5 * 7