K-th minimum#5201

K-th minimum

1 second
128 megabytes
Very easy

Find the -th number in array A = \langle a_1, a_2, \ldots, a_n \rangle sorted in increasing order.

Array is generated with the polynom P(x) = 132x^3 + 77x^2 + 1345x + 1577: a_i = P(i)\bmod 1743.

Input

Two positive integers and (1 \leq k \leq n \leq 50000).

Output

Print the -th number in sorted array .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading