CF762D Maximum path

Description

You are given a rectangular table $ 3×n $ . Each cell contains an integer. You can move from one cell to another if they share a side. Find such path from the upper left cell to the bottom right cell of the table that doesn't visit any of the cells twice, and the sum of numbers written in the cells of this path is maximum possible.

Input Format

The first line contains an integer $ n $ ( $ 1

Output Format

Output the maximum sum of numbers on a path from the upper left cell to the bottom right cell of the table, that doesn't visit any of the cells twice.

Explanation/Hint

The path for the first example: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF762D/d4bf8868df92d7c24fa764038356cd07e2a09006.png)The path for the second example: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF762D/0b9906fb129c151689b202b0d1e93e29e845ce4c.png)