#K3776. Minimum Possible Tower Height

    ID: 26048 Type: Default 1000ms 256MiB

Minimum Possible Tower Height

Minimum Possible Tower Height

You are given n towers with specified heights. You are allowed only to decrease the heights of the towers. Given a range defined by two 1-indexed integers a and b, your task is to determine the minimal possible height that the tallest tower in this range can have after decreasing some (or all) of the towers in that segment.

In other words, if you are allowed to decrease the towers, the best you can do is lower all towers in the segment to the height of the shortest tower among them. Using latex notation, if the heights in the range are \(h_a, h_{a+1}, \dots, h_b\), then your answer is:

[ \min_{i=a}^{b}h_i ]

Make sure to read the input from stdin and write the result to stdout.

inputFormat

The input is given in the following format:

The first line contains a single integer n representing the number of towers.
The second line contains n space-separated integers representing the heights of each tower.
The third line contains two space-separated integers a and b (1-indexed) which define the range to consider.

You should read from stdin.

outputFormat

Output a single integer, the minimal possible height of the tallest tower in the given range after decreasing the heights.

The result should be written to stdout.

## sample
5
5 7 9 10 6
2 4
7