#P7659. [COCI 2014/2015 #5] FUNGHI

[COCI 2014/2015 #5] FUNGHI

Description

Hansel and Gretel got a pizza cut into 88 slices. Each slice has a different number of mushrooms, denoted by S1,S2,...,S8S_1,S_2,...,S_8. Gretel really likes mushrooms, so she wants to find four consecutive slices whose total number of mushrooms is as large as possible.

Note that since the pizza is circular, slice 11 is adjacent to slice 88.

Input Format

There are 88 lines in total, each containing one non-negative integer SiS_i (where ii is the line number), representing the number of mushrooms on that slice.

Output Format

Output one integer on a single line: the maximum number of mushrooms on four consecutive slices.

5
2
1
4
5
1
2
3
12
2
6
5
3
3
7
2
6
19

Hint

For 100%100\% of the testdata, 0Si500 \leq S_i \leq 50.

Translated from COCI 2014/2015 CONTEST #5

Translated by ChatGPT 5