Problem F. Floating formatting

Author:A. Klenin   Time limit:1 sec
Input file:input.txt   Memory limit:64 Mb
Output file:output.txt  

Statement

Floating point numbers can be presented by a computer program in various formats, either exponential or fixed. For example, a number 1234.5 can be presented as "1234.5", "123.45e1", "0.12345e4", "12345e-1" and so on.

You program must find the shortest possible representation of a given floating point number. Representation is allowed to omit both leading and trailing zeros, but must preserve all the other digits.

Input file format

Input file contains a single floating point number. Note that it may be too long to be stored in built-in floating point types without loss of precision.

Output file format

Output file must contain a single string — the shortest representation of the input number. If there is more than one shortest representation, you must choose the one in fixed format, or, failing that, the one with the lowest absolute value of exponent.

Constraints

Input number contains from 1 to 1000 digits and is either 0 or in range from 10 − 2000 to 102000.

Both input and output numbers must contain at least one digit on each side of the decimal point (if the point is present) and must denote exponent with the lowercase letter 'e'.

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
001e-1
0.1
2
1e-002
0.01
3
0.001
1e-3
4
12000
12e3
5
12345e-4
1.2345
6
15e-10
1.5e-9

0.081s 0.007s 13