eolymp
bolt
Try our new interface for solving problems
Problems

Queen Move

Queen Move

Time limit 1 second
Memory limit 128 MiB

There is a queen on the chessboard of size m × n. How many squares does the queen attack?

Input data

Four positive integers: the size of the chessboard m and n and the queen's coordinates x and y~(1 \le x \le m \le 10^9, 1 \le y \le n \le 10^9).

Output data

Print the number of squares the queen attacks.

Examples

Input example #1
8 8
4 5
Output example #1
27
Input example #2
1000000000 3
999999999 2
Output example #2
1000000005