Under construction

Still being built. Things may change

Which One is Larger

Time limit1sMemory limit2048 MB

Summary
Given two decimals, print the larger one if comparing them as integer tuples (integer part, then fraction digits) agrees with normal decimal order, otherwise print -1.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

A question that often confuses a chat bot is:

9.99.9 or 9.119.11, which one is larger?

Some chat bots incorrectly state that 9.119.11 is larger than 9.99.9. The exact reasoning behind that wrong answer is unknown, but one hypothesis is that the chat bot compared the decimal numbers as integer tuples, so that (9,11)>(9,9)(9, 11) > (9, 9). Integer tuples (x_1,y_1)(x\_1, y\_1) and (x_2,y_2)(x\_2, y\_2) are compared by first comparing x_1x\_1 with x_2x\_2. If they are equal, y_1y\_1 is compared with y_2y\_2.

Given two decimal numbers, determine whether the result of integer tuple comparison matches the result of regular decimal comparison. If the two results agree, output the larger decimal number. Otherwise, output −1-1.

You may assume that the chat bot discards leading zeros when converting the digits after the decimal point to an integer, so 4.014.01 becomes (4,1)(4, 1). If the two numbers are equal under integer tuple comparison, that counts as a different result from regular decimal comparison.

Input

Input has two lines. Each line contains one positive decimal number with 1 to 5 digits before the decimal point and 1 to 5 digits after it. There are no leading or trailing zeros, except that a single zero before or after the decimal point is allowed. The two decimal numbers are not equal.

Output

If integer tuple comparison and regular decimal comparison give the same result, output the larger decimal number. Otherwise, output −1-1.

Examples4

  1. Example 1

    Input
    9.9
    9.11
    
    Expected output
    -1
    
  2. Example 2

    Input
    12.34
    5.6789
    
    Expected output
    12.34
    
  3. Example 3

    Input
    0.01
    0.009
    
    Expected output
    -1
    
  4. Example 4

    Input
    4.1
    4.01
    
    Expected output
    -1