Repeating Decimals#6240

Repeating Decimals

5 seconds
128 megabytes
Easy

A routine problem in elementary mathematics is to convert fractions to decimals. For example, \frac{1}{2} is just 0.5, while \frac{1}{3} is 0.333..., which can be simply written as . The decimal 0.5 is said to be terminating, while 0.333... is repeating. Other examples of fractions that convert to repeating decimals are:

\frac{1}{6} = 0.1(6),
\frac{1}{7} = 0.(142857).

Your task is to determine the fraction in lowest terms that is equal to a given repeating decimal.

Input

The input consists of one or more lines. Each line contains a repeating decimal. The digits that repeat are enclosed in a pair of parentheses. The total number of digits in the decimal (excluding leading zeros and the decimal point) is at most .

Output

For each given repeating decimal, output a line containing the input decimal, an equal sign, and the equivalent reduced fraction. The fraction should be displayed in the form x / y, where x is the numerator and y is the denominator.

Examples

Example 1

Loading
Loading