| Udmurt SU Contest 2011 |
|---|
| Закончено |
Trying to get out of Rabbit's house through the ground hole, Pooh got stuck in that hole. Christopher Robin said they should wait for Pooh to get thin. In order to sustain Pooh, Christopher Robin suggested him to write down $$$b$$$-ary representation of $$$\frac{1}{x}$$$. By the time Winnie-the-Pooh finishes his writings, he will surely get thin. How long will it take depends on the number of digits in non-periodic part and the number of digits in periodic part of $$$b$$$-ary representation. Given $$$x$$$, find these numbers.
The only line contains two integers $$$x$$$ and $$$b$$$ ($$$2 \leq x \leq 10^{12}$$$, $$$2 \leq b \leq 10^{18}$$$) where $$$b$$$ is the base of desired representation.
Output the minimal possible lengths of non-periodic part and periodic part.
2 10
1 0
3 10
0 1
2 2
1 0
3 2
0 2
| Название |
|---|


