Xiao Long Bao

No attempts yetTime limit1sMemory limit128 MB

Problem

N dumplings sit in a row, all starting with flavor 0. Eating dumpling ii adds AiA_i flavor to every uneaten dumpling jj with ijDi|i-j| \le D_i. Maximize the total flavor you consume.

Input

Line 1: NN. Line 2: splatter distances DiD_i. Line 3: splash values AiA_i.

Output

Print the maximum total flavor.