1 1 s 128 MB
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.
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.