Problem B
Almennir Borgarar
Languages
en
is

Benni, an ardent competitive programmer (and hamburger
enthusiast), is waiting in line with
Input
The first line of the input contains two integers
Then there is a line with
Output
Print the number of seconds Benni has to wait before he gets his burger, assuming the chefs utilize the grills optimally.
Scoring
Group |
Points |
Constraints |
1 |
20 |
|
2 |
20 |
|
3 |
20 |
|
4 |
10 |
|
5 |
30 |
No further constraints |
Sample Input 1 | Sample Output 1 |
---|---|
2 6 1 2 |
5 |
Sample Input 2 | Sample Output 2 |
---|---|
3 10 2 7 5 |
14 |
Sample Input 3 | Sample Output 3 |
---|---|
4 6 10 120 25 30 |
50 |