SmallR likes a game called "Deleting Substrings". In the game you are given a sequence of integers *w*, you can modify the sequence and get points. The only type of modification you can perform is (unexpected, right?) deleting substrings. More formally, you can choose several contiguous elements of *w* and delete them from the sequence. Let's denote the sequence of chosen elements as *w*<sub class="lower-index">*l*</sub>, *w*<sub class="lower-index">*l* + 1</sub>, ..., *w*<sub class="lower-index">*r*</sub>. They must meet the conditions:
 -  the equality |*w*<sub class="lower-index">*i*</sub> - *w*<sub class="lower-index">*i* + 1</sub>| = 1 must hold for all *i* (*l* ≤ *i* &lt; *r*); -  the inequality 2·*w*<sub class="lower-index">*i*</sub> - *w*<sub class="lower-index">*i* + 1</sub> - *w*<sub class="lower-index">*i* - 1</sub> ≥ 0 must hold for all *i* (*l* &lt; *i* &lt; *r*). 
After deleting the chosen substring of *w*, you gain *v*<sub class="lower-index">*r* - *l* + 1</sub> points. You can perform the described operation again and again while proper substrings exist. Also you can end the game at any time. Your task is to calculate the maximum total score you can get in the game.
The first line contains a single integer *n* (1 ≤ *n* ≤ 400) — the initial length of *w*. The second line contains *n* integers *v*<sub class="lower-index">1</sub>, *v*<sub class="lower-index">2</sub>, ..., *v*<sub class="lower-index">*n*</sub> (0 ≤ |*v*<sub class="lower-index">*i*</sub>| ≤ 2000) — the costs of operations. The next line contains *n* integers *w*<sub class="lower-index">1</sub>, *w*<sub class="lower-index">2</sub>, ..., *w*<sub class="lower-index">*n*</sub> (1 ≤ *w*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the initial *w*.
print("_RANDOM_GUESS_1689597638.2485507")# 1689597638.2485712