Score : $100$ points
There is a grid with $H$ horizontal rows and $W$ vertical columns. Let $(i,j)$ denote the square at the $i$-th row from the top and the $j$-th column from the left.
Find the number of squares that share a side with Square $(R, C)$.
Here, two squares $(a,b)$ and $(c,d)$ are said to share a side if and only if $|a-c|+|b-d|=1$ (where $|x|$ denotes the absolute value of $x$).
Input is given from Standard Input in the following format:
$H$ $W$ $R$ $C$
Print the answer as an integer.
3 4 2 2
4
We will describe Sample Inputs/Outputs $1,2$, and $3$ at once below Sample Output $3$.
3 4 1 3
3
3 4 3 4
2
When $H=3$ and $W=4$, the grid looks as follows.
1 10 1 5
2
8 1 8 1
1
1 1 1 1
0