Chess board (4)

Consider a square chess board with nn rows and nn columns, where every square contains between 0 and 9 coins. Write a program such that, given a chess board, computes the difference between the total number of coins on white aquares and the total number of coins on black squares.

Input

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

Output

Print the total number of coins on white squares, the tthe two diagonals of the board. the total number of coins on black squares, and their difference. Follow the format provided in the examples.

Problem information

Author: Unknown
Translator: Maria Serna

Generation: 2026-01-25T14:58:56.514Z

© Jutge.org, 2006–2026.
https://jutge.org