Bizon the Champion has recently finished painting his wood fence. The fence consists of a sequence of
n panels of
1 meter width and of arbitrary height. The
i-th panel's height is
hi meters. The adjacent planks follow without a gap between them.
After Bizon painted the fence he decided to put a "for sale" sign on it. The sign will be drawn on a rectangular piece of paper and placed on the fence so that the sides of the sign are parallel to the fence panels and are also aligned with the edges of some panels. Bizon the Champion introduced the following constraints for the sign position:
-
The width of the sign should be exactly w meters.
-
The sign must fit into the segment of the fence from the l-th to the r-th panels, inclusive (also, it can't exceed the fence's bound in vertical direction).
The sign will be really pretty, So Bizon the Champion wants the sign's height to be as large as possible.
You are given the desc
ription of the fence and several queries for placing sign. For each query print the maximum possible height of the sign that can be placed on the corresponding segment of the fence with the given fixed width of the sign.
Output
For each query print the answer on a separate line− the maximum height of the sign that can be put in the corresponding segment of the fence with all the conditions being satisfied.
Note
The fence described in the sample looks as follows:
The possible positions for the signs for all queries are given below.
The optimal position of the sign for the first query.
The optimal position of the sign for the second query.
The optimal position of the sign for the third query.