#abc140b. [abc140_b]Buffet

[abc140_b]Buffet

Problem Statement

Takahashi went to an all-you-can-eat buffet with NN kinds of dishes and ate all of them (Dish 11, Dish 22, ldots\\ldots, Dish NN) once.

The ii-th dish (1leqileqN)(1 \\leq i \\leq N) he ate was Dish AiA_i.

When he eats Dish ii (1leqileqN)(1 \\leq i \\leq N), he gains BiB_i satisfaction points.

Additionally, when he eats Dish i+1i+1 just after eating Dish ii (1leqileqN1)(1 \\leq i \\leq N - 1), he gains CiC_i more satisfaction points.

Find the sum of the satisfaction points he gained.

Constraints

  • All values in input are integers.
  • 2leqNleq202 \\leq N \\leq 20
  • 1leqAileqN1 \\leq A_i \\leq N
  • A1,A2,...,ANA_1, A_2, ..., A_N are all different.
  • 1leqBileq501 \\leq B_i \\leq 50
  • 1leqCileq501 \\leq C_i \\leq 50

Input

Input is given from Standard Input in the following format:

NN A1A_1 A2A_2 ...... ANA_N B1B_1 B2B_2 ...... BNB_N C1C_1 C2C_2 ...... CN1C_{N-1}

Output

Print the sum of the satisfaction points Takahashi gained, as an integer.


Sample Input 1

3
3 1 2
2 5 4
3 6

Sample Output 1

14

Takahashi gained 1414 satisfaction points in total, as follows:

  • First, he ate Dish 33 and gained 44 satisfaction points.
  • Next, he ate Dish 11 and gained 22 satisfaction points.
  • Lastly, he ate Dish 22 and gained 5+3=85 + 3 = 8 satisfaction points.

Sample Input 2

4
2 3 4 1
13 5 8 24
45 9 15

Sample Output 2

74

Sample Input 3

2
1 2
50 50
50

Sample Output 3

150