Problem:
Score : 300 points

Problem Statement

There are N integers a_1, a_2, ..., a_N not less than 1.
The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P.

Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N.

Constraints

1 \leq N \leq 10^{12}

1 \leq P \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N P

Output

Print the answer.

Sample Input 1

3 24

Sample Output 1

2

The greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.

Sample Input 2

5 1

Sample Output 2

1

As a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.

Sample Input 3

1 111

Sample Output 3

111

Sample Input 4

4 972439611840

Sample Output 4

206

Solution in Common Lisp (SBCL 1.1.14) (judge verdict: Accepted)

;; -*- coding:utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload :cl-debug-print))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defun make-prime-table (size)
  "Erzeugt die Primzahlentabelle 0 zu SIZE-1."
  (declare (optimize (speed 3) (safety 1)))
  (let ((dict (make-array size :element-type 'bit :initial-element 1)))
    (setf (aref dict 0) 0 (aref dict 1) 0)
    (loop for even-num from 4 below size by 2
          do (setf (aref dict even-num) 0))
    (loop for p from 3 to (ceiling (sqrt size)) by 2
          when (= 1 (aref dict p))
          do (loop for composite from (+ p p) below size by p
                   until (>= composite size)
                   do (setf (aref dict composite) 0)))
    dict))

(defun decompose-to-pow-table (num prime-table)
  (declare (optimize (speed 3) (safety 1))
           (fixnum num) ; Beachte!
           ((simple-array bit (*)) prime-table))
  (let ((factor-table (make-array (length prime-table)
                                  :element-type '(unsigned-byte 7)
                                  :initial-element 0)))
    (when (= 1 (aref prime-table 2))
      (setf (aref factor-table 2)
            (loop while (evenp num)
                  count t
                  do (setf num (ash num -1)))))
    (loop for prime from 3 to (min num (- (length prime-table) 1)) by 2
          when (= 1 (aref prime-table prime))
          do (setf (aref factor-table prime)
                   (loop while (zerop (mod num prime))
                         count t
                         do (setf num (floor num prime))))
          finally (return factor-table))))

(defmacro println (obj &optional (stream '*standard-output*))
  `(prog1 (princ ,obj ,stream) (terpri ,stream)))

;; Hauptteil

;; Sei gcd(a1, ..., aN) = 2^f(2)*3^f(3)*....
;; Da P = a1* ... *aN, gilt gcd(a1, ..., aN)^N | P und somit
;; 2^(f(2)*N)*3^(f(3)*N)*... | P
;; Wir müssen nur so ein f finden, so dass jedes f(k) maximal ist.
;; Nun sei 2^g(2)*3^g(3)*.... die Primfaktorzerlegung von P.
;; Dann muss f Folgendes erfüllen:
;; f(2)* N <= g(2)
;; f(3)* N <= g(3)...

(defun main ()
  (let* ((n (read))
         (p (read))
         (size 100001)
         (prime-dict (make-prime-table size))
         (factor-table (decompose-to-pow-table p prime-dict)))
    (if (= n 1)
        (println p)
        (loop for prime from 2 below size
              with product = 1
              when (>= (aref factor-table prime) 1)
              do (setf product
                       (* product (expt prime (floor (aref factor-table prime) n))))
              finally (println product)))))

#-swank(main)