Separating in lines

Given a natural number nn, a base bb, and a natural number qq, print nn in base bb, but placing the digits of nn in groups of qq at every line.

Input

Input consists of several cases, each with n>0n > 0, 2b102 \le b \le 10, and q>0q > 0.

Output

For every case, print nn in base bb, but placing qq digits at every line. If the number of digits of nn in base bb is not a multiple of qq, the first line must be the shortest. Print a line with 10 dashes at the end of every case.

Observation

You should not use vectors or alike to solve this problem.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T12:01:29.174Z

© Jutge.org, 2006–2026.
https://jutge.org