LearnPy Hub
← Arena
AdvancedRating 2000

Two Walkers Collect Cherries

Two walkers start in the top-left cell of an n × n grid and both walk to the bottom-right, moving only right or down. Each cell holds some cherries (≥ 0); a cell's cherries are collected once even if both walkers pass it. Print the most cherries they can collect.

Input

n (≤ 30), then n rows.

Output

One integer.

Sample 1

Input
3
0 1 1
1 0 1
1 1 1
Output
7

Sample 2

Input
1
5
Output
5
solution.py
Output appears here
Two Walkers Collect Cherries · Python Arena problem · LearnPy Hub