Arya is taking part in a game of throwing marbles upwards. There are participants in this game in total, where Arya is the participant with label . Each participant is given a marble and initially each of the marbles are held at ground level (height ). Each participant throws his marble straight upwards at time with initial velocity and it drops back on the ground after some time.
The marble will follow basic rules of physics while travelling in the air. So if a marble hasn't yet dropped back on the ground and time units have passed since it was thrown with initial velocity , its current velocity and current height can be expressed as follows:
Here, .
You have to answer queries, where you will be given an integer in each query.
For each query, count how many marbles have a strictly greater height than Arya's marble at time .
First line of the input contains two space-separated integers and , denoting the number of participants and the number of queries.
Next lines each contains two integers and , denoting when participant threw the marble and its initial velocity.
Next lines each contains one integer , denoting the query time.
For each query, output a single line containing one single integer denoting the number of marbles with a strictly greater height than Arya's marble at the query time.
Input | Output |
---|---|
5 10 5 40 4 50 3 50 2 50 1 50 1 2 3 4 5 6 7 8 9 10 | 0 1 2 3 4 4 4 4 3 3 |