While wandering around the city, Molly got distracted by a drone shop and went in. In the shop, there were drones available for purchase. Molly lives in a city where there are buildings in a line, each with specific heights . Being cheap, the drones from this shop have some weird technical specifications, the height interval that they need to start from. With this in mind, Molly asks you to tell her how many contiguous subsequences of buildings have the shortest building in the specified range of each drone, and .
For all subtasks:
Subtask 1 [5%]
Subtask 2 [25%]
Subtask 3 [70%]
The first line of input will contain two space-separated integers, and .
The second line of input will contain space-separated integers, where .
The next lines of input will each contain two space-separated integers, and .
Note: Fast I/O methods are recommended for this problem.
Your program should output integers on different lines, representing the number requested for each drone.
5 1 3 2 4 5 3 3 4