Discrete logarithm#487

Discrete logarithm

3 seconds
64 megabytes
Easy

Given positive integers , a_1, a_2, , a_N, you are required to compute \mathrm{floor}(\log_b a_1), , \mathrm{floor}(\log_b a_N), where denotes the greatest integer not exceeding .

Input

The input file contains the numbers , , a_1, a_2, , a_N in a single line.

Output

The output file should contain integers—the results of the calculations.

1 \leq N \leq 1000, 2 \leq b \leq 100, 1 \leq a_i < 10^{1000} (i.e., each number may contain up to digits).

Examples

Example 1

Loading
Loading