Question
One Alarm Robbery

There are n houses in a row. You cannot rob adjacent houses, and across the whole night you may rob at most one house marked as alarmed. Find the maximum total money.

Input

First line: KaTeX can only parse string typed expression.
Second line: house values.
Third line: binary alarm flags.

Output

Print the maximum obtainable money.

Example
Input:
6

5 1 8 4 10 3
0 1 0 1 0 0
Output:
23

Online