题目描述
Problem Description
$\texttt{piggy}$ has built an enormous $\texttt{PIG}$ building, which can be considered as a plane. On this plane, there are $n$ infinitely long escalators that are neither perpendicular nor parallel to the ground, and can be seen as linear functions. All these escalators are directed towards the positive $x$-axis direction.
The intersection point of two escalators allows for a transfer at the cost of $1 \ \texttt{ZMB}$.
A person wants to send a text message to $\texttt{piggy}$ to come over.
However:

So, he has to walk over to $\texttt{piggy}$.
He is currently standing at the position where the $x_1$-th escalator has a vertical coordinate of $y_1$.
$\texttt{piggy}$ is at the position where the $x_2$-th escalator has a vertical coordinate of $y_2$.
How many $\texttt{ZMB}$ does he need to spend at the minimum to get there?
Input Format
The first line contains a positive integer $n$.
The second line contains four integers $x_1, y_1, x_2, y_2$.
The next $n$ lines, the $i$-th line contains two numbers $k_i, b_i$, representing the linear equation of the escalator as $y = k_i x + b_i$.
Output Format
Output the minimum number of $\texttt{ZMB}$ required. If it is not possible to reach the destination, output -1.
Sample Input and Output
Input Sample #1
1
1 1 1 2
50 -30
Output Sample #1
0
Input Sample #2
2
1 2 2 2
1 0
2 0
Output Sample #2
-1
Input Sample #3
2
1 -1 2 1
1 0
2 0
Output Sample #3
1
Notes
This problem uses Subtasks.
$\sf Subtask1(20pts)$: $1 \le n \le 10$;
$\sf Subtask2(30pts)$: $1 \le n \le 1000$;
$\sf Subtask3(50pts)$: $1 \le x_1, x_2 \le n \le 10^5$, $-10^3 \le y_1, y_2, k_i, b_i \le 10^3$.
The escalators are numbered starting from 1.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分