There are N mountains lying in a horizontal row, numbered from 0 through N - 1from left to right. The height of the mountain i is Hi (0 ≤ i ≤ N - 1). Exactly one person lives on the top of each mountain.
You are going to hold Q meetings, numbered from 0 through Q - 1. The meeting j (0 ≤ j ≤ Q - 1) will be attended by all the people living on the mountains from Lj to Rj, inclusive (0 ≤ Lj ≤ Rj ≤ N - 1). For this meeting, you must select a mountain x as the meeting place (Lj ≤ x ≤ Rj). The cost of this meeting, based on your selection, is then calculated as follows:
For each meeting, you want to find the minimum possible cost of holding it.
Note that all participants go back to their own mountains after each meeting; so the cost of a meeting is not influenced by the previous meetings.