In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].

If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.

The Painter's Studio is preparing mass production of paintings. Paintings are going to be made with aid of square matrices of various sizes. A matrix of size consists of rows and columns. There are holes on intersections of some rows and columns. Matrix of size has one hole.

For , matrix of size is built of four squares of size . Look at the following figure (“bez otworow” means “with no holes” in Polish, “matryca stopnia” means “matrix of size”):

Both squares on the right side and the bottom-left square are matrices of size . Top-left square has no holes. Pictures are constructed in the following way. First, we fix three non-negative integers . Next, we take two matrices of size , place one of them onto the other and shift the upper one columns right and rows up. We place such a pattern on a white canvas and cover the common part of matrices with the yellow paint. In this way we get yellow stains on the canvas in the places where the holes in both matrices agree.

Consider two matrices of size .

The upper matrix was shifted columns right and rows up. There are three places where holes agree.

Write a program that:

- reads the sizes of two matrices and the numbers of columns and rows that the upper matrix should be shifted by, from the standard input;
- computes the number of yellow stains on the canvas;
- writes the result to the standard output.

There is one integer , in the first line of the standard input. This number is the size of matrices used for production of paintings. In the second line there is one integer and in the third line one integer , where . The integer is the number of columns and is the number of rows that the upper matrix should be shifted by.

In the first line of the standard output there should be written the number of stains on the canvas.

For the input data:

2 2 2

the correct result is:

3

*Task author: Wojciech Rytter.*