HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


Matrix

Section problems

• Куб
• Maze
• Лесенки
• Skiers
• Максимум из минимумов
• Маршрут
• Find all duplicates in array
• Find the Missing number
• Matrix
• Range Minimum Query
• Министерство правды
• Coins and nests
• Монополия
• Муравей
• Ball
• Наименьшее число
• Новый язык программирования

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