New-year presents#26

New-year presents

1 second
128 megabytes
Medium

Santa Claus and the Snow-maiden must deliver presents to children.

Each present requires packing by the Snow-maiden, taking t_1 time per present, and delivery by Santa Claus, taking t_2 time per present. Santa Claus can carry only one present at a time. Determine the minimum possible total time required to deliver all the presents.

Input

The first line contains the number of presents (1 \leq n \leq 300).

The second line contains integers: the packing times for each present by the Snow-maiden.

The third line contains integers: the delivery times for each present by Santa Claus.

It is guaranteed that 0 < t_1, t_2 \leq 1000 for every present.

Output

Print the minimum possible time required to deliver all the presents.

Examples

Example 1

Loading
Loading