English · Original
Chinese · Translation
Formal · Original
Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.
The desk can be considered as an infinite plane, then the mousetrap is a rectangle which sides are parallel to the axes, and which opposite sides are located in points (_x_1, _y_1) and (_x_2, _y_2).
Igor wants to catch all mice. Igor has analysed their behavior and discovered that each mouse is moving along a straight line with constant speed, the speed of the _i_\-th mouse is equal to (_v__i__x_, _v__i__y_), that means that the _x_ coordinate of the mouse increases by _v__i__x_ units per second, while the _y_ coordinates increases by _v__i__y_ units. The mousetrap is open initially so that the mice are able to move freely on the desk. Igor can close the mousetrap at any moment catching all the mice that are **strictly** inside the mousetrap.
Igor works a lot, so he is busy in the dream as well, and he asks you to write a program that by given mousetrap's coordinates, the initial coordinates of the mice and their speeds determines the earliest time moment in which he is able to catch all the mice. Please note that Igor can close the mousetrap only once.
## Input
The first line contains single integer _n_ (1 ≤ _n_ ≤ 100 000) — the number of computer mice on the desk.
The second line contains four integers _x_1, _y_1, _x_2 and _y_2 (0 ≤ _x_1 ≤ _x_2 ≤ 100 000), (0 ≤ _y_1 ≤ _y_2 ≤ 100 000) — the coordinates of the opposite corners of the mousetrap.
The next _n_ lines contain the information about mice.
The _i_\-th of these lines contains four integers _r__i__x_, _r__i__y_, _v__i__x_ and _v__i__y_, (0 ≤ _r__i__x_, _r__i__y_ ≤ 100 000, - 100 000 ≤ _v__i__x_, _v__i__y_ ≤ 100 000), where (_r__i__x_, _r__i__y_) is the initial position of the mouse, and (_v__i__x_, _v__i__y_) is its speed.
## Output
In the only line print minimum possible non-negative number _t_ such that if Igor closes the mousetrap at _t_ seconds from the beginning, then all the mice are **strictly** inside the mousetrap. If there is no such _t_, print _\-1_.
Your answer is considered correct if its absolute or relative error doesn't exceed 10 - 6.
Formally, let your answer be _a_, and the jury's answer be _b_. Your answer is considered correct if .
[samples]
## Note
Here is a picture of the first sample
Points A, B, C, D - start mice positions, segments are their paths.

Then, at first time when all mice will be in rectangle it will be looks like this:

Here is a picture of the second sample

Points A, D, B will never enter rectangle.
Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.
The desk can be considered as an infinite plane, then the mousetrap is a rectangle which sides are parallel to the axes, and which opposite sides are located in points $(x1, y1)$ and $(x2, y2)$.
Igor wants to catch all mice. Igor has analysed their behavior and discovered that each mouse is moving along a straight line with constant speed, the speed of the $i$-th mouse is equal to $(vix, viy)$, that means that the $x$ coordinate of the mouse increases by $vix$ units per second, while the $y$ coordinates increases by $viy$ units. The mousetrap is open initially so that the mice are able to move freely on the desk. Igor can close the mousetrap at any moment catching all the mice that are *strictly* inside the mousetrap.
Igor works a lot, so he is busy in the dream as well, and he asks you to write a program that by given mousetrap's coordinates, the initial coordinates of the mice and their speeds determines the earliest time moment in which he is able to catch all the mice. Please note that Igor can close the mousetrap only once.
The first line contains single integer $n$ ($1 ≤ n ≤ 100 000$) — the number of computer mice on the desk.
The second line contains four integers $x1$, $y1$, $x2$ and $y2$ ($0 ≤ x1 ≤ x2 ≤ 100 000$), ($0 ≤ y1 ≤ y2 ≤ 100 000$) — the coordinates of the opposite corners of the mousetrap.
The next $n$ lines contain the information about mice.
The $i$-th of these lines contains four integers $rix$, $riy$, $vix$ and $viy$, ($0 ≤ rix, riy ≤ 100 000$, $ - 100 000 ≤ vix, viy ≤ 100 000$), where $(rix, riy)$ is the initial position of the mouse, and $(vix, viy)$ is its speed.
In the only line print minimum possible non-negative number $t$ such that if Igor closes the mousetrap at $t$ seconds from the beginning, then all the mice are *strictly* inside the mousetrap. If there is no such $t$, print _-1_.
Your answer is considered correct if its absolute or relative error doesn't exceed $10 - 6$.
Formally, let your answer be $a$, and the jury's answer be $b$. Your answer is considered correct if .
Here is a picture of the first sample
Points A, B, C, D - start mice positions, segments are their paths.
Then, at first time when all mice will be in rectangle it will be looks like this:
Here is a picture of the second sample
Points A, D, B will never enter rectangle.
## Input
The first line contains single integer $n$ ($1 ≤ n ≤ 100 000$) — the number of computer mice on the desk.The second line contains four integers $x1$, $y1$, $x2$ and $y2$ ($0 ≤ x1 ≤ x2 ≤ 100 000$), ($0 ≤ y1 ≤ y2 ≤ 100 000$) — the coordinates of the opposite corners of the mousetrap.The next $n$ lines contain the information about mice.The $i$-th of these lines contains four integers $rix$, $riy$, $vix$ and $viy$, ($0 ≤ rix, riy ≤ 100 000$, $ - 100 000 ≤ vix, viy ≤ 100 000$), where $(rix, riy)$ is the initial position of the mouse, and $(vix, viy)$ is its speed.
## Output
In the only line print minimum possible non-negative number $t$ such that if Igor closes the mousetrap at $t$ seconds from the beginning, then all the mice are *strictly* inside the mousetrap. If there is no such $t$, print _-1_.Your answer is considered correct if its absolute or relative error doesn't exceed $10 - 6$. Formally, let your answer be $a$, and the jury's answer be $b$. Your answer is considered correct if .
[samples]
## Note
Here is a picture of the first samplePoints A, B, C, D - start mice positions, segments are their paths.Then, at first time when all mice will be in rectangle it will be looks like this:Here is a picture of the second samplePoints A, D, B will never enter rectangle.
**Definitions**
Let $ n \in \mathbb{Z}^+ $ be the number of mice.
Let $ R = [x_1, x_2] \times [y_1, y_2] \subset \mathbb{R}^2 $ be the rectangular mousetrap, with $ x_1 \le x_2 $, $ y_1 \le y_2 $.
For each mouse $ i \in \{1, \dots, n\} $:
- Initial position: $ \mathbf{p}_i = (r_{ix}, r_{iy}) \in \mathbb{R}^2 $
- Velocity vector: $ \mathbf{v}_i = (v_{ix}, v_{iy}) \in \mathbb{R}^2 $
- Position at time $ t \ge 0 $: $ \mathbf{p}_i(t) = (r_{ix} + t \cdot v_{ix},\ r_{iy} + t \cdot v_{iy}) $
**Constraints**
1. $ 1 \le n \le 100{,}000 $
2. $ 0 \le x_1 \le x_2 \le 100{,}000 $, $ 0 \le y_1 \le y_2 \le 100{,}000 $
3. $ 0 \le r_{ix}, r_{iy} \le 100{,}000 $
4. $ -100{,}000 \le v_{ix}, v_{iy} \le 100{,}000 $
**Objective**
Find the minimal $ t \ge 0 $ such that for all $ i \in \{1, \dots, n\} $:
$$
x_1 < r_{ix} + t \cdot v_{ix} < x_2 \quad \text{and} \quad y_1 < r_{iy} + t \cdot v_{iy} < y_2
$$
If no such $ t $ exists, output $ -1 $.
API Response (JSON)
{
"problem": {
"name": "C. Mice problem",
"description": {
"content": "Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them. The desk can be considered as an infini",
"description_type": "Markdown"
},
"platform": "Codeforces",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "CF793C"
},
"statements": [
{
"statement_type": "Markdown",
"content": "Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.\n\nThe desk can be considered as an infini...",
"is_translate": false,
"language": "English"
},
{
"statement_type": "Markdown",
"content": "Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.\n\nThe desk can be considered as an infini...",
"is_translate": true,
"language": "Chinese"
},
{
"statement_type": "Markdown",
"content": "**Definitions** \nLet $ n \\in \\mathbb{Z}^+ $ be the number of mice. \nLet $ R = [x_1, x_2] \\times [y_1, y_2] \\subset \\mathbb{R}^2 $ be the rectangular mousetrap, with $ x_1 \\le x_2 $, $ y_1 \\le y_2 $....",
"is_translate": false,
"language": "Formal"
}
]
}