h(n)

Given n up to 10^18, find the smallest x with x raised to d(x), its divisor count, equal to n, or -1.

Medium7Number theoryBinary searchMathNo attempts yetTime limit2sMemory limit512 MB

Problem

Seonggwan is studying a function hh defined on the positive integers.

First, let d(n)d(n) be the number of distinct positive divisors of nn.

Then h(n)h(n) is nn raised to the power d(n)d(n), that is h(n)=nd(n)h(n) = n^{d(n)}.

For example, d(6)=4d(6) = 4, so h(6)=64=1296h(6) = 6^4 = 1296.

Given an integer nn, write a program that finds the smallest positive integer xx with h(x)=nh(x) = n.

Input

The first line contains nn (2n10182 \le n \le 10^{18}).

Output

Print the smallest positive integer xx with h(x)=nh(x) = n on the first line. If no such xx exists, print 1-1.