| NCTU PCCA Winter Contest 2021 |
|---|
| Finished |
Carl the shark goes to his favorite restaurant for dinner. There is a special event happening today: if he plays and wins a game, the restaurant will offer free chicken nuggets as prize!
The game is set up as follows:
Then, the game is played by one player. The player should do the following:
Carl has a chance to play the game. Since chicken nuggets are his favorite food, he wishes to get as many chicken nuggets as possible. However, the number of plates is so large that he can't possibly calculate the result of the game. Can you help him out?
The first line consists of one integer $$$n$$$. The second line contains $$$n - 1$$$ integers $$$a_2, a_3, \dots, a_n$$$. The third line contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$.
Technical specification:
Print one integer, the maximum amount of chicken nuggets Carl can receive from the game.
3 1 1 3 6 5
9
4 1 2 2 5 6 7 8
26
| Name |
|---|


