eolymp
bolt
Try our new interface for solving problems
Problems

Spring Time

Spring Time

From prehistoric times the division of numbers was considered one of the most difficult tasks. There was a time when the <<secret>> of division was known to the few and it was given from generation to generation. The reason for this was that the existing division algorithms were too cumbersome and complex to use and remember. When long division appeared the situation was radically changed --- right now division is included in the early school program in mathematics with the other arithmetic operations. Nevertheless, not everybody did good at school. Thus, for example, two campers bought a ground area last week. In the buying agreement the size of the area that belongs to each of the campers was indicated in the form of the decimal fraction. But none of them had a clue how they can divide the area according to these numbers as the numbers were periodic decimal fractions. The first line of the input gives an integer Т (T<20) indicating number of tests. Every other of the Т lines gives a fraction in the decimal notation 0.\[\](), the length of every input line is no more than 13 symbols. For every test your program has to output the fraction in the form of nonreducible fraction \[/\], if the denominator equals to 1 it should not be printed. Every fraction is printed in a new line.
Time limit 1 second
Memory limit 64 MiB
Input example #1
1
0.(3)
Output example #1
1/3