This page is still under construction.

Parts of this page are still being built. What you see may change.

h(n)

Time limit2sMemory limit512 MB

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

Medium7 of 10

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

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 (2≤n≤10182 \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.

Examples4

  1. Example 1

    Input
    4
    
    Expected output
    2
    
  2. Example 2

    Input
    10
    
    Expected output
    -1
    
  3. Example 3

    Input
    64
    
    Expected output
    4
    
  4. Example 4

    Input
    10000
    
    Expected output
    10