Decimal Representation of Rational Numbers

A rational number is one that can be expressed as a fraction k/m, where k and m are integers and m is nonzero. It turns out that these are also the numbers than can be expressed in repeating decimal form. That is, every rational number can also be written in the form

p.d1 d2 d3 ... dn-r ( dn-r+1 dn-r+2 ... dn )

where p is an integer, each di is a digit between 0 and 9, and the parentheses around the last r digits indicate that that sequence of digits repeats forever.

Notice that the repeating decimal representation of a rational number is not unique. For example, the rational number 13/6 is represented by each of 2.1(6), 2.16(6), and 2.1(66) (as well as infinitely many other such expressions). We say that a repeating decimal representation is in simplest form if the number of digits appearing after its decimal point is the minimum possible. Thus, for example, the simplest repeating decimal representation of 13/6 is 2.1(6). As another example, the simplest repeating decimal representation of 40/4 is 10.(0).

You are to develop a program that can translate a given rational number into its simplest repeating decimal form. The input will consist of a sequence of rational numbers, each given on one line by a pair of nonnegative integers, the first representing a numerator and the second a denominator. For each rational number given as input, your program should produce a line of output containing its simplest repeating decimal representation.

In order to simplify the task of producing output, your results are to be written in the form

p.d1 d2 ¼ dn    r,

where r indicates the length of the repeating sequence of digits. (See sample output below.)

Sample Input

14 5
131 350

Sample Output

2.80 1
0.37428571 6