Java vs. Scheme Smackdown

No attempts yetTime limit1sMemory limit256 MB

Problem

Edgar thinks he knows it all.

He has programmed in Java before, and he believes every number a computer stores is inexact. On top of that, Java programs are mostly made of dots, as in System.out.please.oh.please.println(). So Edgar decided that Java keeps only the first few digits of a number between 0 and 1 and writes the rest as a run of dots. The number 1/61/6, for example, is stored as "0.1666...". After Scheme showed him that numbers can be stored exactly, he wants to rewrite his Java programs with the exact representation.

Many fractions fit one recorded digit string. Edgar takes the simplest one, meaning the one with the smallest denominator. He also assumes Java keeps enough significant digits, so the repeating block was written out in full at least once. That holds even when the repeating block is nothing but zeros.

Given a recorded digit string, find the original fraction. Exactly one fraction with the smallest denominator satisfies these rules.

Input

The input holds several test cases. Each test case is one line of the form 0.dddd..., where dddd is a string of 1 to 9 digits that are not all zero, followed by three periods. The recorded value is greater than 0 and less than 1.

A line containing a single 0 follows the last test case. There are at most 1000 test cases.

Output

For each test case, print the original fraction on its own line as p/q, where p and q are coprime positive integers and there is no space around the slash.

A terminating decimal has two repeating expansions. 1/51/5, for example, is both 0.2000... and 0.1999.... Either recording maps back to the same fraction.