Total Triangles

Find the best scoring path through the triangle.

Run 1

Input

4
4 1
1 4 1
1 4 1 1

Expected Output

16