Limits 1s, 512 MB

You are given a matrix with size **N * N**. You need to print the summation for each of the rows, followed by each of the columns, followed by the two diagonals (among the diagonals, print major diagonal first, and then minor diagonal), and finally the sum of all values in the matrix.

This is a companion discussion topic for the original entry at https://toph.co/p/sum-of-n-n