Problems
Fraction
Fraction
There are two numbers, a
and b
. It is required to calculate the value a/b and write it in the k
-based number system.
Input data
The input consists of several tests (not more than 100) separated by a line break. Each test consists of three integers 1 ≤ a ≤ 10000
, 1 ≤ b ≤ 10000
, 2 ≤ k ≤ 36
. There are two zeros in the last line.
Output data
For each test, output a line containing the representation of the number a/b in the k
-based number system. The integer part must be separated from the fractional part by a point. If the number a/b is whole, then there should be no point. The output must not contain insignificant zeros. If the fraction a/b is periodic, then its period must be given in parentheses.
Examples
Input example #1
10 5 2 1 2 8 8780 1 29 2794 6083 23 157 7 19 1 12 10 0 0
Output example #1
10 0.4 ACM 0.(ACM) 13.(82DAG5) 0.08(3)