Consider a sequence of positive integers $a_1, a_2, a_3, \dots$. The first term $a_1$ is given. For every $i > 1$, the term $a_i$ is the smallest integer that satisfies both of the following conditions:
Given the first term $a_1$ and an index $n$, output the value of $a_n$.
A single line contains two integers $a_1$ and $n$ separated by a space ($0 < a_1 < 20$, $0 < n < 10000$).
Print a single integer: the value of $a_n$. All test data are chosen so that $a_n$ does not exceed $10^9$.