Fraction
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
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
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
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 #1
Answer #1
Submissions 290
Acceptance rate 18%