Chess board (3) P19991


Statement
 

pdf   zip

html

Consider a square chess board with n rows and n columns, where every square contains between 0 and 9 coins. Write a program such that, given a chess board, computes the total number of coins on its two diagonals.

Input

Input begins with the size n of the board. Follow n lines, each one with n characters between ‘0’ and ‘9’.

Output

Print the total number of coins on the two diagonals of the board.

Public test cases
  • Input

    4
    2389
    3402
    3956
    2018
    

    Output

    39
    
  • Input

    3
    975
    123
    450
    

    Output

    20
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python