#1. Alt+W+N 입력하고 Alt+W+V :
import sys
sys.stdin = open("input.txt", "rt")
n = int(input())
a = [list(map(int,input().split()))for _ in range(n)]
res = 0
for i in range(n):
sum1 = 0
sum2 = 0
for j in range(n):
sum1 += a[i][j]
sum2 += a[j][i]
if sum1 > sum2:
if sum1>res:
res = sum1
else:
if sum2>res:
res = sum2
sum1 = 0
sum2 = 0
for i in range(n):
sum1 += a[i][i]
sum2 += a[n-i-1][i]
if sum1 > sum2:
if sum1>res:
res = sum1
else:
if sum2>res:
res = sum2
print(res)
#1. Alt+W+N 입력하고 Alt+W+V :
import sys
sys.stdin = open("input.txt", "rt")
n = int(input())
a = [list(map(int,input().split()))for _ in range(n)]
largest = -217000000
for i in range(n):
sum1 = sum2 = 0
for j in range(n):
sum1 += a[i][j]
sum2 += a[j][i]
if sum1 > largest:
largest = sum1
if sum2>largest:
largest = sum2
# 한번만 하면 되네... 이런..... 한번을 줄여주셨다 센세가..
sum1 = 0
sum2 = 0
for i in range(n):
sum1 += a[i][i]
sum2 += a[i][n-i-1]
if sum1 > largest:
largest = sum1
if sum2>largest:
largest = sum2
print(largest)
if else 문 2번 줄이셨네... 에휴 안유진 바보