A garden row has n flowers in fixed positions. Flower i opens on day bloom[i] and stays open afterward. To assemble one bouquet you need k adjacent flowers that are all open, and each flower can belong to at most one bouquet (bouquets do not share flowers). You want m bouquets.
Find the earliest day D such that, using only flowers open on or before day D, you can assemble m bouquets. It is guaranteed that m * k <= n, so some day always works.
Input format
Line 1: three integers n, m, and k.
Line 2: n space-separated integers, the bloom days in row order.
Output format
A single integer: the earliest day by which m bouquets can be assembled.
Constraints
- 1 <= n <= 40
- 1 <= k <= n
- 1 <= m and m * k <= n
- 1 <= each bloom day <= 1000000000