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

#SP0000268. Lũy thừa của số nguyên tố (Prime Power)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Lũy thừa của số nguyên tố (Prime Power)

Prime Power

Source: VNOJ

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer NN is a prime power of exponent greater than one if N=pqN=p^q for a prime number pp and an integer q>1q>1.

Given NN, determine whether such p,qp,q exist. If they exist, print them; otherwise print 00.

Input

One line contains a positive integer NN.

Output

If N=pqN=p^q with prime pp and q>1q>1, print p q on one line; otherwise print 0.

Subtasks

  • Subtask 1 (20 points): 1≤N≤1061\le N\le10^6.
  • Subtask 2 (30 points): 1≤N≤10121\le N\le10^{12}.
  • Subtask 3 (50 points): 1≤N≤10181\le N\le10^{18}.

Examples

Example 1

Input

27

Output

3 3

Explanation

27=3327=3^3 and 33 is prime, with exponent 3>13>1. Hence print 3 3.

Example 2

Input

10

Output

0

Explanation

10=2⋅510=2\cdot5 has two distinct prime factors, so no such prime power representation exists. Print 0.

Example 3

Input

64

Output

2 6

Explanation

64=2664=2^6. Although 64=8264=8^2, 88 is not prime; the required pair is 2 6.