All problems

Problem 861

Closest Divisors

Medium · 20 pts · Math

Problem

Find two positive integers whose product is NUM + 1 or NUM + 2 and whose absolute difference is as small as possible. Print them in increasing order. If the best difference is reached by both NUM + 1 and NUM + 2, use the pair for NUM + 1. For each of the two targets, the closest divisor pair comes from the largest divisor d not exceeding its square root, found by counting down from the square root.

Input

A single integer NUM.

Output

Print the two numbers in increasing order, separated by a space.

Constraints

1 <= NUM <= 10^9

Example input

8

Example output

3 3

Explanation

For NUM = 8, the candidates are 9 = 3 × 3 (difference 0) and 10 = 2 × 5 (difference 3). The pair 3 3 is closer, so it is the answer.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Number of Common Factors Next: Three Divisors