There are H rows and W columns of white square cells. You will choose h of the rows and…
- User
There are H rows and W columns of white square cells.
You will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.
How many white cells will remain?
It can be proved that this count does not depend on what rows and columns are chosen.
Constraints
- All values in input are integers.
- 1 \leq H, W \leq 20
- 1 \leq h \leq H
- 1 \leq w \leq W
Input
Input is given from Standard Input in the following format:
H W h w
Output
Print the number of white cells that will remain.
Examples
Input
3 2 2 1
Output
1
Input
5 5 2 3
Output
6
Input
2 4 2 4
Output
0
Assistant
We need to compute number of white cells remaining after painting all cells contained in chosen h rows and w columns. The initial grid: H rows, W columns. We choose any h rows and w columns. We paint all cells that are in those rows OR those columns. So the painted cells are union of the selected rows and selected columns. The remaining white cells are those not in selected rows AND not in selected columns. Since we can choose any h rows and w columns, but problem says it's proven that count does not depend on the particular rows and columns chosen. So we can compute number of cells that are not in the selected rows and not in selected columns for any selection: total cells H*W minus number of cells painted.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.