Cyclic Numbers

Given two positive integers, that represent a rational number as a fraction, we want to produce the decimal periodic representation of the fraction’s value. A decimal periodic representation has the following form: d1 ...di.dj ...dl(dm ...dn) where each d is a decimal digit and the inclusion of dm...dn between parenthesis means that this sequence of digits is repeated forever. We call (dm . . . dn) the periodic part of the representation. As examples of decimal periodic representations, consider for instance: 1/3 = 0.(3) 13/66 = 0.1(96) 170/12 = 14.1(6) 24/6 = 4.0 Notice that the periodic part is omitted if the decimal expansion of the fraction is finite, as illustrated by the last example. All fractions can be represented precisely, in a finite way, using this kind of representation. However we cannot give an explicit bound for the size of the periodic part (see for example the second fraction in the sample input below). Input The first line contains a non-negative integer n, which is the number of fractions to convert to the decimal periodic representation. The following n lines contain two positive integers, respectively the numerator and the denominator of the fraction to be converted. Output For each fraction in the input, there must be a line in the output containing its decimal periodic representation. Sample Input 7 4 33 912 89 120 3 131 909 146 325 12345 88 18 12000 Sample Output 0.(12) 10.(24719101123595505617977528089887640449438202) 40.0 0.(1441) 0.44(923076) 140.284(09) 0.0015