#2665 Be Rational

1 s   128 MB  

Description

Captain Jean-Luc Picard and the crew of the U.S.S. Enterprise NCC-1701-D have been dispatched yet again to negotiate a peace treaty, this time between two warring cultures, the Decimators and the Fractionalists. They have fought for many years over the correct way to represent rational numbers. The Decimators represent each rational number as a possibly repeating decimal number, such 0.444... (which they write as 0.(4) with parentheses to denote the repeated part), whereas the Fractionalists represent each rational number as a fraction, such as 4/9. After a devastating war in which hundreds of millions died, the Fractionalists have won. The crew of the U.S.S. Enterprise has the task of converting all numbers in the treaty to fractional form.

Input

The input contains a single test case.

The input consists of a positive rational number, represented as a possibly repeating decimal number. The whole number part comes first, and is always present. The whole number part may then be followed by both a period and a decimal part. The decimal part may end with a repeating part, which is contained in parentheses. For example, 0.(4) represents the repeating decimal number 0.444. . . . There is no whitespace within a line. Each test case is no more than 10 characters long.

 

last input is possible "END" or EOF(end of file)

Output

 

Output a single line containing a fraction representing the input rational number. The fraction must be in reduced form i.e. the numerator and denominator contain no common factor.

Sample Input

Sample Output

0.(6)
2/3

Source

ACM South Pacific Eastern Division 2015 C, ACM South Pacific Central Division 2015 G