For each input instance, the output should consist of the decimal expansion of the fraction, starting with the decimal point. If the expansion terminates, you should print the complete decimal expansion. If the expansion is infinite, you should print the decimal expansion up to, but not including the digit where the repeated pattern first repeats itself.
For instance, 4/11 = .3636363636..., should be printed as .36. (Note that the shortest repeating pattern should be found. In the above example, 3636 and 363636, among others, are repeating patterns, but the shortest repeating pattern is 36.)
Since some of these expansions may be quite long, multiple line expansions should each contain exactly 50 characters on each line (except the last line, which, of course, may be shorter) - that includes the beginning decimal point.
On the line immediately following the last line of the decimal expansion there should be a line saying either ``This expansion terminates.", or ``The last n digits repeat forever.", where n is the number of digits in the repeating pattern.
Helpful hint: The number of digits before the pattern is repeated will never be more than the value of the denominator.