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

~/algor $ cat problems/nuqta-oqlardami

Is the point on an axis?

Easy 1000 ms 64 MB 23%
Share

A point $(x; y)$ is given on the coordinate plane. Print $0$ if the point is at the origin, $1$ if it lies only on the $OX$ axis, $2$ if it lies only on the $OY$ axis, and $3$ otherwise.

Where a point lies: on the coordinate axes or in the plane

Input

One line with two integers: $x$ and $y$.

Output

One integer: $0$, $1$, $2$ or $3$.

Note

$-10^{9} \le x, y \le 10^{9}$

Examples

Input #1
0 0
Output #1
0
Input #2
5 0
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.