Programming Problem #3
"Repeating Decimals"

A rational number is of the form n/d, where n and d are both integers and d is greater than 0. Every rational number has either a finite or repeating decimal representation. For example, 3/8 = 0.375, and 22/7 = 3.142857, where the sequence of digits in boldface repeats forever.

The input consists of one or more lines, each containing a pair of positive integers less than 32768, separated by a space. The first number is the numerator n and the second is the denominator d. For each line of input, display the decimal equivalent of n/d exactly as shown below, identifying the repeating digits in the fractional part of n/d, if any. Note that n, d and the integer part of n/d are each right-justified in a field of width 5, the equals sign is surrounded by exactly one space, the decimal point must be preceded and followed by at least one digit, and the outputs are separated by a blank line. You must identify the minimal, leftmost sequence of repeating fractional digits if the decimal representation does in fact repeat. If the fractional part is longer than 50 digits and there is no repeating sequence contained within the first 50 digits, output the first 50 digits followed by "...".

Note: To identify a repeating sequence of length 50 will require you to calculate 100 fractional digits (to verify the repetition).

Input must be read from the file "prob3.in", and output must be written to the file "prob3.out". All output to the screen will be ignored.


Example Input

<BOF>
27836 462
1315 227
1 252
30003 16
<EOF>

Example Output

27836         ------
----- =    60.251082
  462

 1315
----- =     5.79295154185022026431718061674008810572687224669603...
  227

    1           ------
----- =     0.00396825
  252

30003
----- =  1875.1875
   16

Dr. Eric Shade