You are waiting in line to obtain ski rentals at Hack the North 2017. To get your ski, you must wait in one of three lines. Each line will have
At the end of every
How long will it take for all skiers to get their rentals?
Input Specification
The first line of input consists of three integers separated by spaces:
The second line of input will have the wait times for the
The third line of input will have the wait times for the
The fourth line of input will have the wait times for the
It is guaranteed that
- For 4 of the 15 available marks,
and . - For an additional 4 of the 15 available marks,
and . - For an additional 4 of the 15 available marks,
.
Output Specification
The output will contain a single integer, the number of seconds it takes for all skiers to get their rentals.
Sample Input 1
2 1 3
30 20
30
30 10 20
Sample Output 1
50
Sample Input 2
3 2 3
20 5 4
15 9
8 9 5
Sample Output 2
29
Comments
If there isn't a tie for the shortest or longest line, does the skier at the back of the longest line move to the back of the shortest line or the back of the second-shortest line, or the back any of those two lines?
The skier will move to the back of the shortest line (the one with the least amount of people).