VANDAL | 프로그래밍의 벗 PivotOJ
PivotOJ

VANDAL

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2007 National Competition #1 - JuniorsBOJ 3139
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

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). 

[이미지 1] [이미지 2] [이미지 3]
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. 

예제

예제 1

입력
4
1 1 4 4
출력
12
6 6

예제 2

입력
7
1 4 11 5
출력
19
13 6

예제 3

입력
8
2 6 7 12
출력
24
16 8
코드를 제출하려면 로그인하세요.