# 递归
n = int(input())
lst1 = []
for i in range(n):
lst1.append([int(i) for i in input().split()])
ll = []
# 递归函数效率效率太低,运行超时
def df2(l, i, j, s, c):
if len(l[i]) <= j or j < 0:
return
s += l[i][j]
i += 1
if i == n:
if abs(c) <= 1:
ll.append(s)
return
df2(l, i, j, s, c + 1)
df2(l, i, j + 1, s, c - 1)
df2(lst1,0,0,0,0)
print(max(ll))
# 循环
n = int(input())
trg = [list(map(int, input().split())) for i in range(n)]
f = []
def path(n, trg):
for i in range(n):
f.append([])
for j in range(i + 1):
f[i].append(0)
if i == 0:
f[i][j] = trg[i][j]
elif j == 0:
f[i][j] = f[i - 1][j] + trg[i][j]
elif j == i:
f[i][j] = f[i - 1][j - 1] + trg[i][j]
else:
f[i][j] = max(f[i - 1][j - 1], f[i - 1][j]) + trg[i][j]
if n % 2 != 0:
return f[n - 1][n // 2]
else:
return max(f[n - 1][n // 2], f[n - 1][(n - 1) // 2])
print(path(n, trg))