410540: GYM104048 A Copper Corners

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Copper Cornerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are manufacturing sheets of copper for the Copper Corporation. Each sheet is broken up into individual units that form a square. The value that a sheet of copper will sell for is the sum of the copper amounts of the units in the top left corner, top right corner, bottom left corner, and bottom right corner. If the entire sheet is only made up of one unit, then the value of the sheet is simply the value of the one unit.

Input

The first line of input will contain a single integer $$$s$$$ ($$$1 \leq s \leq 50$$$), representing the number of units in a single row of the copper square. The next $$$s$$$ lines will each contain $$$s$$$ space separated positive integers, representing copper amounts in all the units that form the square. Every unit has a copper amounts of at most $$$1000$$$.

Output

Output the value of the given sheet of copper.

ExamplesInput
1
7
Output
7
Input
3
1 3 4
3 1 4
5 7 2
Output
12

加入题单

上一题 下一题 算法标签: