#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Statement

Takahashi and Aoki have recently started trading stonks to make some money.

For the next N days, Aoki will buy some stonks in the morning. On the *i ^{th}* morning, he will buy

*A*stonks.

_{i}Takahashi has written a script to predict the trends of the stonk market. Thus, he knows that on the *i ^{th}* day, he can sell a stonk for

*B*yen. He can only sell stonks which were purchased on or before that day.

_{i}Takahashi wants to know the maximum amount of money they can make selling stonks (ignore the money Aoki spends buying stonks). Code a program to help him!

## Input

The first line of input contains a single integer *N*.

The next line of input contains *N* integers, representing the array *A*.

The last line of input contains *N* integers, representing the array *B*.

## Output

The first and only line of output should contain a single integer, denoting the maximum amount of money made selling stonks.

## Limits

For all subtasks, 1 ≤ *N*, *A _{i}*,

*B*≤ 1000000.

_{i}Subtask 1 (20%): *N* ≤ 1000

Subtask 2 (15%): *A _{i}* = 1

Subtask 3 (65%): There are no more constraints.

## Sample Input

7 2 8 3 2 8 4 5 9 8 7 5 4 4 8

## Sample Output

258

## Explanation

Takahashi can sell 2 stonks on day 1, 5 stonks on day 2 and 25 stonks on day 7 for 258 yen total. This is optimal.

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 20 | 11 | 1s | 256MB | Minimum |

2 | 15 | 10 | 1s | 256MB | Minimum |

3 | 65 | 31 | 1s | 256MB | Minimum |

4 | 0 | 1 | 1s | 256MB | Minimum |

### Judge Compile Command

g++-8 ans.cpp -o stonks -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512