题目描述
Problem Description
stove is a resident of a certain flat world.
One day, stove discovered mines that yield a lot of gold in both the desert and the jungle.
stove decided to devote 7 days to mining in these mines.
Since the desert and the jungle are located far apart, stove can only mine at one of the mines each day.
The amount of gold mined varies from day to day depending on the weather and mood, so the choice of mine may differ each day.
Given the amount of gold that can be mined each day, write a program to determine the maximum amount of gold that can be obtained by choosing the mines optimally.
Input Format
The input is given from the standard input in the following format:
$ D_1 $ $ D_2 $ .. $ D_7 $ $ J_1 $ $ J_2 $ .. $ J_7 $
- The first line contains 7 integers separated by spaces, representing the information about the desert mine. The $ i $-th integer $D_i\ (0\ ≦\ D_i\ ≦\ 2,000)$ indicates the amount of gold in kilograms that can be obtained on the $ i $-th day if mining in the desert mine.
- The second line contains 7 integers separated by spaces, representing the information about the jungle mine. The $ i $-th integer $J_i\ (0\ ≦\ J_i\ ≦\ 2,000)$ indicates the amount of gold in kilograms that can be obtained on the $ i $-th day if mining in the jungle mine.
Output Format
Output the maximum amount of gold that can be obtained by choosing the mines optimally in one line. Ensure a newline at the end of the output.
Sample Input and Output
Sample Input #1
4 2 0 5 6 2 5
6 1 4 3 6 4 6
Sample Output #1
33
Sample Input #2
1 2 3 4 5 6 7
2 3 4 5 6 7 8
Sample Output #2
35
Sample Input #3
0 0 0 0 0 0 0
0 0 0 0 0 0 0
Sample Output #3
0
Sample Input #4
8 3 0 2 5 25 252
252 252 2 5 2 5 2
Sample Output #4
793
Notes/Hints
Sample Explanation 1
The following actions are optimal:
- On the 1st day, choose the jungle mine and obtain 6 kilograms of gold.
- On the 2nd day, choose the desert mine and obtain 2 kilograms of gold.
- On the 3rd day, choose the jungle mine and obtain 4 kilograms of gold.
- On the 4th day, choose the desert mine and obtain 5 kilograms of gold.
- On the 5th day, choose the desert mine and obtain 6 kilograms of gold.
- On the 6th day, choose the jungle mine and obtain 4 kilograms of gold.
- On the 7th day, choose the jungle mine and obtain 6 kilograms of gold.
By following this plan, stove can obtain 6 + 2 + 4 + 5 + 6 + 4 + 6 = 33 kilograms of gold. Note that choosing the jungle mine on the 5th day would also achieve the same amount.
Sample Explanation 2
Choosing the jungle mine exclusively is the best option.
Sample Explanation 3
In this case, no gold can be obtained. What was the story about gold all about?
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分