Booklets

Time limit1sMemory limit128 MB

Problem

Bob must distribute advertising booklets for extra-curricular activities to several schools. The booklets have different numbers of pages. Given the page count of every booklet and the number of schools, Bob hands them out so that each school receives either the lower integer part (LIP) or the upper integer part (UIP) of (number of booklets) / (number of schools) — that is, $\lfloor B / S \rfloor$ or $\lceil B / S \rceil$ booklets, where $B$ is the number of booklets and $S$ is the number of schools.

Bob must also obey these rules:

  • He serves all the schools that receive the UIP count of booklets first, and only then the schools that receive the LIP count.
  • If a school $S_i$ is served before a school $S_j$ (that is, $i < j$), then every booklet given to $S_i$ has no more pages than any booklet given to $S_j$. Equivalently, across schools the booklets are handed out in non-decreasing order of pages.
  • The booklets given to a single school are handed out in the same relative order in which they appear on Bob's list.

Back at the company, Bob's boss asks for the number of pages of the first booklet distributed to a particular school, where schools are numbered from $0$ in the order Bob served them. Compute that number.

Input

The input contains several data sets; read them until the end of the file. Each data set gives, in order: the number of schools, the index of the school specified by the boss (numbered from $0$), the number of booklets (fewer than $3000$), and then the number of pages of each booklet (each value fits in an integer). Whitespace may appear freely between the numbers. The input is always valid.

Output

For each data set, print on its own line the number of pages of the first booklet distributed to the specified school.