Given three positive integers , you should find two non-negative integers that and minimize . Print the minimum . Here will be given in format where denotes the primary factor and its power respectively.
Hint: you can use "__int128_t" in C++ to handle 128-bit integers.
输入描述:
The first line contains one integer .
Following lines each contains two integers .
Following one line contains two integers , where .
It's guaranteed that s are all primes and .
输出描述:
Output one line only containing one integer, denoting the answer.