### company

#### Problem Description

There are *n* kinds of goods in the company, with each of them has a inventory of and direct unit benefit . Now you find due to price changes, for any goods sold on day *i*, if its direct benefit is *val*, the total benefit would be *i*⋅*val*.

Beginning from the first day, you can and must sell only one good per day until you can't or don't want to do so. If you are allowed to leave some goods unsold, what's the max total benefit you can get in the end?

#### Input

The first line contains an integers *n*(1≤*n*≤1000).

The second line contains *n* integers *val*1,*val*2,..,*val**n*(−100≤.≤100).

The third line contains *n* integers *cnt*1,*cnt*2,..,*cnt**n*(1≤≤100).

#### Output

Output an integer in a single line, indicating the max total benefit.

#### Sample Input

4 -1 -100 5 6 1 1 1 2

#### Sample Output

51

#### Hint

sell goods whose price with order as -1, 5, 6, 6, the total benefit would be -1*1 + 5*2 + 6*3 + 6*4 = 51.