К-th minimum#824

К-th minimum

1 second
128 megabytes
Very easy (≈850)

Find the -th number in array A =~< a_1, a_2, ..., a_n > sorted in increasing order.

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

Input

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

Output

Print the -th number in sorted array .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading