URI Online Judge | 1305

Cut Off Rounder

By TopCoder* USA

Timelimit: 1

Often, when we round a real valued number to an integer, we round up if the fractional part is 0.5 or greater, and down if the fractional part is less than 0.5. In this problem, you have to write a method round, which takes a real valued number as a String, num, and a cutoff as a String, cutoffcutoff will be formatted exactly as "0.####", where each '#' represents a digit ('0'-'9'). At least one of the digits to the right of the decimal point in cutoff will be non-zero. Your task is to round num up if its fractional part is greater than cutoff, and down otherwise, and return the result as an int. To avoid issues with double imprecision, the fractional part of num will not be exactly equal to cutoff. Hence, the traditional rounding method described in the opening sentence would be represented by cutoff = "0.5000".

Input

The input contains several test cases. Each one is given in two lines. The num string is at the first line and the cutoff is at the second line. num will be a sequence of one or more digits ('0'-'9'), with an optional decimal point ('.'). num will contain between 1 and 10 characters, inclusive. cutoff will be formatted exactly as "0.####", where each '#' represents a digit ('0'-'9'). The fractional part of num will NOT be exactly equal to cutoff.

The input is terminatted by EOF.

Output

Your program should output one line to each test case. This line contains only the integer part of num rounded up or down according to the given cutoff.

 Sample Input Sample Output 003.656930 0.5000 .001 0.0001 1.99999999 0.9999 135 0.6531 135. 0.6531 1356.13671 0.1367 0.00010001 0.0001 4 1 2 135 135 1357 1