HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


Matrix

Section problems

• Divisors
• Pizza delivery
• Railway turnout
• Door lock
• Сoordinate quarters
• Куб
• Maze
• Skiers
• Matrix
• Range Minimum Query
• Министерство правды
• Coins and nests
• Монополия
• Муравей
• Ball
• Huge parking
• Islands areas

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/4000/4000/4000 ms. Memory limit 32000/65000/65000/65000 Kb.

Problem description

Calculate sum of diagonal and by-diagonal (sideline) elements in square matrix.

Input

Line 1: A single integer N (1 < N ≤ 10);

Line 2..N+1: N positive integers on each line not bigger than 100 elements of matrix.

Output

Write sum of diagonal and by-diagonal elements.

Example

stdin stdout

3
1 2 3
2 2 2
3 2 1

10

Для отправки решений необходимо выполнить вход.

www.contester.ru