Under construction

Still being built. Things may change

Aftermath

Time limit2sMemory limit512 MB

Summary
Given the integer arithmetic mean a and integer harmonic mean h of the divisors of an unknown n up to 10^15, recover any valid n.
Level

Hard8 of 10

Topics
Number theory, Math, Brute force, Implementation
Solved
No attempts yet

Problem

Once upon a time, you had a nice positive integer nn.

Since you like division, you quickly found all its positive integer divisors.

Not being a mean guy, you calculated aa, the arithmetic mean of the divisors of nn. Surprisingly, this number turned out to be an integer.

Some time passed, and you calculated hh, the harmonic mean of the divisors of nn. Even more surprisingly, this number turned out to be an integer, too.

Unfortunately, your memory let you down, and now you remember aa and hh but don't remember nn. However, you remember that nn did not exceed 101510^{15}.

Your muse suggested to bring the good old times back and restore any value of nn matching your records.

Input

The first line of the input contains a single positive integer aa.

The second line of the input contains a single positive integer hh.

It is guaranteed that there exists a positive integer n≤1015n \le 10^{15} such that the arithmetic mean of the divisors of nn equals aa, and the harmonic mean of the divisors of nn equals hh.

Output

Output any positive integer nn not exceeding 101510^{15} that does not contradict the given information.

Notes

The arithmetic mean is the sum of a collection of numbers divided by the number of numbers in the collection. For example, the arithmetic mean of 1, 2, 3, 6 is 1+2+3+64=3\frac{1 + 2 + 3 + 6}{4} = 3.

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the numbers in the collection. For example, the harmonic mean of 1, 2, 3, 6 is (1−1+2−1+3−1+6−14)−1=2\big( \frac{1^{-1} + 2^{-1} + 3^{-1} + 6^{-1}}{4} \big)^{-1} = 2.

Thus, in the first example, n=6n = 6 satisfies the requirements since its divisors are 1, 2, 3, 6.

Examples1

  1. Example 1

    Input
    3
    2
    
    Expected output
    6