## Sergey vs Teachassist

View as PDF

Points: 7 (partial)
Time limit: 1.5s
Memory limit: 64M

Author:
Problem type

When he isn't asserting his dominance with chess skills, Serog1sPerog1s can be found staring at his computer while frantically reloading TeachAssist. Because of this, he never has time to do his chemistry homework and now his mark has plummeted.

Fortunately his teacher Mr. Bemistry has given him an opportunity to save his mark and his sanity. He offered to let him substitute some of his test marks for his corresponding project mark from the same unit. However, he must make sure that he subs in no more than 2 projects from consecutive units. Mr. B also reminds him that each unit has a unique weighting in the course and that his marks are extremely accurate, down to 5 decimal places.

With his busy schedule of chess and reloading, Serog1sPerog1s is in panic has no time to figure out what to do. With a face as red as sriracha and tears flowing down like the Niagara, he begs you to tell him the fate of his precious mark.

#### Input Specification

The first line of the input will contain an integer , representing the number of units in the course.

The second line will contain floating point numbers denoting the weighting of each unit .

The third line will contain floating point numbers denoting the test percentage for each unit .

The fourth line will contain floating point numbers denoting the project percentage for each unit .

All decimal input can have up to 5 decimal places. The sum of will always be 100.

#### Output Specification

The maximum mark he can get, rounded down to the nearest integer.

#### Sample Input

4
30.00000 20.00000 10.00000 40.00000
90.00000 91.00000 92.00000 93.00000
94.00000 95.00000 96.00000 97.00000

#### Sample Output

95

#### Explanation

Serog1sPerog1s can switch to his first, second, and fourth project marks to get a mark of , or .