Category

Similar Problems

0722. Massive Numbers

Time limit : 1000 ms
Memory limit : 64 mb

 The number is called massive if it is represented in the form  a^n, which means a raised in power n. You need to compare two massive numbers ab and cd, written in the form “<base>^<exponent>”.

   Given two massive numbers, print the biggest one.

   Input

  Two massive numbers a and b in the form “<base>^<exponent>”. It is known that 1 ≤ <base>, <exponent> ≤ 20000. It is guaranteed that given numbers are not equal.

   Output

   The biggest number among a and b.

Samples

Input

Output

1

3^100 2^150

3^100

2

1^1000 2^1

2^1

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com