|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||39||10||10||29.412%|
In an effort to make his village a great tourist attraction, Mirko has drawn a big (N×N) white-gray chessboard on his village hall.
The rows and columns on the chessboard are numbered 1 to N. The bottom-left cell has coordinates (1, 1) and is colored grey. The diagonals of types 1 and 2 are numbered 1 through 2N-1, like in the following figure (with N=4).
|Rows and columns||Type 1 diagonals||Type 2 diagonals|
The chessboard became a great attraction, but what Mirko didn't expect was that other people would become jealous of his creation. He was unpleasantly surprised when he saw that during the night a hooligan (vandal) ruined all the work he had done on the chessboard with just four brush strokes – he painted black all the cells in one row, one column, one diagonal of type 1 and one of type 2!
Before the workday begins, and the tourists rush to the village, he has to repaint all the cells the vandal painted, so that the chessboard looks exactly the same as before the incident.
Write a program that calculates the total number of cells that need to be repainted, and how many of them need to be painted white and grey.
The first line of input contains the integer N (1 ≤ N ≤ 10 000 000), the dimension of the chessboard.
The second line of input contains four integers. Those numbers represent, in order, the row, column, diagonal of type 1, and the diagonal of type 2 which the vandal painted in black.
On the first line of output, output the total number of cells that need to be repainted.
On the second line, output how many of the cells need to be painted grey and how many white.
4 1 1 4 4
12 6 6
7 1 4 11 5
19 13 6
8 2 6 7 12
24 16 8