P1493 Sharing Pears

Description

There is a pear tree in Finley's yard, and it has recently produced many pears. Finley decides to pick some pears to distribute to the kindergarten children. However, the pears vary in size and taste, so it is important to choose pears that are as similar as possible to give to the kids, so that those who get smaller pears will not cry. Each pear has two attributes, $A_i$ and $B_i$, representing the pear's size and sweetness, respectively. Suppose among the selected pears, the minimum values of the two attributes are $A_0$ and $B_0$. As long as for every selected pear $i$, the inequality $C_1 \times (A_i-A_0)+C_2 \times (B_i-B_0) \le C_3$ holds (where $C_1,C_2$ and $C_3$ are known constants), then these pears are considered similar enough and can be given to the children. As the kindergarten principal, can you compute the maximum number of pears that can be selected?

Input Format

The first line contains an integer $N$ ($1 \le N \le 2000$), the total number of pears. The second line contains three positive integers, $C_1,C_2$ and $C_3$ ($C_1,C_2 \le 2000$, $C_3 \le 10^9$). The next $N$ lines each contain two integers. On the $i$-th line, the two integers are $A_i$ and $B_i$.

Output Format

Output a single integer, the maximum number of pears that can be selected.

Explanation/Hint

Sample explanation: You can choose pears $1,3$ or $2,3$. Translated by ChatGPT 5