eolymp
bolt
Try our new interface for solving problems
Problems

Root of the Problem

Root of the Problem

Given positive integers b and n, find an integer a such that an is as close as possible to b. (The result a is an approximation to the n-th root of b.)

Note that an may be less than, equal to, or greater than b.

Input

Consists of one or more pairs of values for b and n. Each pair appears on a single line, delimited by a single space. A line specifying the value zero for both b and n marks the end of the input. The value of b will be in the range 1 to 106 (inclusive), and the value of n will be in the range 1 to 9 (inclusive).

Output

For each pair b and n print a as defined above on a line by itself.

Time limit 1 second
Memory limit 122.17 MiB
Input example #1
4 3
5 3
27 3
750 5
1000 5
2000 5
3000 5
1000000 5
0 0
Output example #1
1
2
3
4
4
4
5
16
Source 2006 ACM North America, Mid-Central, Problem G