Bribing Eve
Eve works at a magazine that does product reviews and publishes recommendations to consumers. They are working on a new mobile phones review and have decided on two reproducible tests that score each device's battery lifetime and performance using an integer between 1 and 1000.
These two scores, x[1]
and x[2]
, are then combined with a weights vector w = [w[1]
, w[2]
] to produce an overall score: s = w[1]
* x[1]
+ w[2]
* x[2]
.
The final review ranking is then obtained by sorting the products by decreasing order of s. Additionally, when multiple products get exactly the same score, Eve decides how to order them.
Maria (a fake name to mask her identity) tried to bribe Eve to tweak the results to get her product higher on the list. Eve argued that she was not able to tamper the evaluation of each test, but Maria suggested to tweak the weights w used when computing the overall score. The weights w must be non-negative reals and at least one of them must be positive, but the values are decided by Eve.
Eve is thinking whether to modify the weights in Maria's benefit or not, and asked you to determine what are the best and worst possible ranking positions for Maria's product.
Given a list of all products scores in battery and performance [x[1]
, x[2]
] tests, find out what are the best and worst positions in the ranking that can be given to Maria's product when the weights [w[1]
, w[2]
] and the order for tied products are left for Eve to decide.
Input
The first line has the number n (1 ≤ n ≤ 10^5
) of products being compared. n lines follow, each containing two integers x[1]
and x[2]
(1 ≤ x[1]
, x[2]
≤ 1000) indicating a product's score in the battery and performance tests. Maria's product is the first on the list.
Output
The output consists of two numbers a and b, indicating the best and worst possible positions that Maria's product can get on the ranking given Eve's ability to modify the weights and ordering in case of a tie.