Problem9538--ABC238 —— B - Pizza

9538: ABC238 —— B - Pizza

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

We have a circular pizza.  
Takahashi will cut this pizza using a sequence $A$ of length $N$, according to the following procedure.

-   First, make a cut from the center in the $12$ o'clock direction.
-   Next, do $N$ operations. The $i$-th operation is as follows.
    -   Rotate the pizza $A_i$ degrees clockwise.
    -   Then, make a cut from the center in the $12$ o'clock direction.

For example, if $A=(90,180,45,195)$, the procedure cuts the pizza as follows.



Find the center angle of the largest pizza after the procedure.

Input

Input is given from Standard Input in the following format:

```
$N$
$A_1$ $A_2$ $\dots$ $A_N$
```

Output

Print the answer as an integer.

Constraints

-   All values in input are integers.
-   $1 \le N \le 359$
-   $1 \le A_i \le 359$
-   There will be no multiple cuts at the same position.

Sample 1 Input

4
90 180 45 195

Sample 1 Output

120
This input coincides with the example in the Problem Statement.
The center angle of the largest pizza is 120 degrees.

Sample 2 Input

1
1

Sample 2 Output

359

Sample 3 Input

10
215 137 320 339 341 41 44 18 241 149

Sample 3 Output

170

Source/Category