{"problem":{"name":"Adjacent Squares","description":{"content":"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","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc250_a"},"statements":[{"statement_type":"Markdown","content":"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.  \nFind the number of squares that share a side with Square $(R, C)$.\nHere, 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$).\n\n## Constraints\n\n*   All values in input are integers.\n*   $1 \\le R \\le H \\le 10$\n*   $1 \\le C \\le W \\le 10$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$H$ $W$\n$R$ $C$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc250_a","tags":[],"sample_group":[["3 4\n2 2","4\n\nWe will describe Sample Inputs/Outputs $1,2$, and $3$ at once below Sample Output $3$."],["3 4\n1 3","3"],["3 4\n3 4","2\n\nWhen $H=3$ and $W=4$, the grid looks as follows.\n\n*   For Sample Input $1$, there are $4$ squares adjacent to Square $(2,2)$.\n*   For Sample Input $2$, there are $3$ squares adjacent to Square $(1,3)$.\n*   For Sample Input $3$, there are $2$ squares adjacent to Square $(3,4)$.\n\n![image](https://img.atcoder.jp/abc250/abc250a-fig1.png)"],["1 10\n1 5","2"],["8 1\n8 1","1"],["1 1\n1 1","0"]],"created_at":"2026-03-03 11:01:14"}}