Problem K. Kind of cheating

Author:И. Блинов   Time limit:1 sec
Input file:Standard input   Memory limit:512 Mb
Output file:Standard output  

Statement

Paulundra is participating in speed climbing competitions. This discipline involves participants undergoing qualification rounds, followed by paired races. The following rules apply during a paired race:

Paulundra won the qualification with the best time and observed the strategy of each of the n participants in the competition. She knows that participant number i plans to complete the route in ti seconds and knows the probability in percentage that this participant will fall pi. Paulundra also knows that she can complete the route in any time between a and b, and the probability of falling at the chosen time x can be calculated as 1 − x − ab − a.

Help Paulundra choose the optimal time xi for each opponent so that the probability of Paulundra's victory is maximized. If there are multiple optimal times, choose the one that is smaller.

Input format

The first line of input contains two integers a and b. The second line of input contains an integer n. The following n lines each contain two integers ti and pi.

Output format

Output n integers xi.

Constraints

1 ≤ n ≤ 105

1 ≤ a, b, ti ≤ 109

1 ≤ pi ≤ 100

a < b

Sample tests

No. Standard input Standard output
1
1 5
5
4 10
10 50
1 99
5 50
2 90
4
5
1
5
2

0.076s 0.011s 13