시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
10 초 512 MB 47 30 30 63.830%

문제

You are to find the sum of the outer number of an isosceles right triangle.

For example, for n = 5 the isosceles right triangle grid are filled with integers as follows:

5   
1   8 
9   6  1 
2   7  2  6 
3   5  7  8  9

The sums of the outer integers are calculated as below:

sum = 5 + 1 + 9 + 2 + 3 + 5 + 7 + 8 + 9 + 6 + 1 + 8 = 64

입력

The input consists of a few test cases. For each test case, the first line of input is a positive integer n (n <= 10) that determines the dimension of the triangle. Each of the next n lines contains 1 to n integers respectively that will fill the isosceles right triangle. Input is terminated by a case where n is 0.

출력

Each line of output will start with “Case #:” where # is replaced by the case number. Then you have to output the sum of the outer numbers of the triangle.

예제 입력 1

5
5   
1 8  
9 6 1  
2 7 2 6  
3 5 7 8 9
3
1 
2 3
4 5 6
0

예제 출력 1

Case #1:64 
Case #2:21