This page is still under construction.

Parts of this page are still being built. What you see may change.

Entrance Examination

Time limit1sMemory limit256 MB

Summary
Pick the cutoff n between nmin and nmax with a strict score split that maximizes the gap between the lowest passing and highest failing scores.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

The International Competitive Programming College (ICPC) is known for its research on competitive programming. Every applicant to the college takes an entrance examination.

The college chooses the successful applicants by these rules.

  • The score of every successful applicant is higher than the score of every unsuccessful applicant.
  • The number of successful applicants nn is at least nminn_{min} and at most nmaxn_{max}. Within that range, pick the nn that maximizes the gap. The gap is the lowest score among the successful applicants minus the highest score among the unsuccessful applicants.
  • When two or more values of nn give the same gap, pick the greatest one.

For example, let nminn_{min} be 2, let nmaxn_{max} be 4, and let the five scores be 100, 90, 82, 70, 65. For nn equal to 2, 3, 4 the gaps are 8, 12, 5. The gap is largest at nn equal to 3, so the answer is 3. With the same nminn_{min} and nmaxn_{max} and the scores 100, 90, 80, 75, 65, the gaps are 10, 5, 10. Both 2 and 4 reach the maximum, so pick the greater one, 4.

Given the scores of the applicants, write a program that computes the number of successful applicants.

Input

The input consists of several datasets. Each dataset has this format.

m nmin nmax
P1
P2
...
Pm

The first line holds three integers separated by single spaces. mm is the number of applicants, nminn_{min} is the minimum number of successful applicants, and nmaxn_{max} is the maximum number of successful applicants. Each of the next mm lines holds one score PiP_i. The scores are given in descending order, and the same score may appear more than once.

The input satisfies 0<nmin<nmax<m≤2000 < n_{min} < n_{max} < m \le 200, 0≤Pi≤100000 \le P_i \le 10000 (1≤i≤m1 \le i \le m), and Pnmin>Pnmax+1P_{n_{min}} > P_{n_{max}+1}. An nn satisfying the rules therefore always exists.

A line holding three zeros separated by single spaces marks the end of the input. Do not process that line.

Output

For each dataset, print the number of successful applicants on its own line.

Examples2

  1. Example 1

    Input
    5 2 4
    100
    90
    82
    70
    65
    5 2 4
    100
    90
    80
    75
    65
    3 1 2
    5000
    4000
    3000
    4 2 3
    10000
    10000
    8000
    8000
    4 2 3
    10000
    10000
    10000
    8000
    5 2 3
    100
    80
    68
    60
    45
    0 0 0
    
    Expected output
    3
    4
    2
    2
    3
    2
    
  2. Example 2

    Input
    3 1 2
    10
    5
    0
    0 0 0
    
    Expected output
    2