There are N boxes and N balls. You are playing a game that goes as follows.
The boxes are enumerated by sequential integers from 1 to N, and the balls are also enumerated by sequential integers from 1 to N. The i-th box initially contains the ball P_i.
Each box is either open or closed. Initially, all boxes are closed.
Then two rounds of ball movement are performed. In each round, you:
After two rounds, for each i, the box i must contain the ball i. Find the minimal sum of coins you shall pay to complete the game.
The first line of input contains one integer N (1≤N≤105).
The second line contains N integers P_1,P_2,…,P_N: here, P_i is the number of the ball that was initially placed in i-th box (1≤P_i≤N, P_i=P_j if i=j).
The third line contains N integers A_1,A_2,…,A_N: here, A_i is the price of opening the i-th box for the first round (1≤A_i≤109).
The fourth line contains N integers B_1,B_2,…,B_N: here, B_i is the price of opening the i-th box for the second round (1≤B_i≤109).
Print one integer: the minimal sum of coins you need to pay to have i-th ball in the i-th box for each i after two rounds.