Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/boolean-tortburchak-ichidami

Inside the rectangle?

Easy 1000 ms 64 MB 19%
Share

A rectangle with sides parallel to the coordinate axes is given on the plane: its lower-left corner is $(x_{1}; y_{1})$ and its upper-right corner is $(x_{2}; y_{2})$. A point $(x; y)$ is also given. Check whether the statement is true: “the point lies inside the rectangle or on its border”.

A rectangle and a point inside it

Input

The first line contains four integers: $x_{1}$, $y_{1}$, $x_{2}$ and $y_{2}$.
The second line contains two integers: $x$ and $y$.

Output

One integer: $1$ if the statement is true, otherwise $0$.

Note

$-10^{9} \le x_{1} \lt x_{2} \le 10^{9}$
$-10^{9} \le y_{1} \lt y_{2} \le 10^{9}$
$-10^{9} \le x, y \le 10^{9}$

Examples

Input #1
0 0 4 3
2 1
Output #1
1
Input #2
0 0 4 3
5 1
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.