#K74312. Maximum Magical Potency

    ID: 34170 Type: Default 1000ms 256MiB

Maximum Magical Potency

Maximum Magical Potency

You are given an \(n \times n\) grid, where each cell of the grid represents the magical potency of a fruit in an orchard. Your task is to determine the maximum magical potency that can be collected by choosing any straight horizontal or vertical line (i.e. a complete row or a complete column).

In other words, compute the sum of all elements in each row and each column, and output the maximum among these sums. Formally, if \(R_i\) is the sum of the \(i\)-th row and \(C_j\) is the sum of the \(j\)-th column, you need to find \(\max(\max_{0 \le i < n} R_i, \max_{0 \le j < n} C_j)\).

Example:

Input:
3
1 2 3
4 5 6
7 8 9

Output: 24

</p>

inputFormat

The input is given via standard input and has the following format:

  1. The first line contains a single integer \(n\) — the size of the grid.
  2. The next \(n\) lines each contain \(n\) space-separated integers, representing the rows of the grid.

outputFormat

The output should be a single integer printed to standard output, representing the maximum magical potency (the maximum sum of any row or column).

## sample
3
1 2 3
4 5 6
7 8 9
24