Erzhan is a hard working scientist at a top-secret nuclear research facility. Recently, he and his colleagues made a groundbreaking discovery of three new elements: Beshium[Bs], Dastarhanium[Da], and Kumysium[Km]. They have theorized that the nuclear fusion reaction caused by combining all three of these elements results in a massive output of clean and "safe" energy.
Isolation of these elements is only possible inside the special tube. Currently, there are exactly n atoms of each element type and we know their coordinates. By manipulating magnetic fields, scientists can choose which three atoms to combine. However, the only stable reaction is [Bs] − [Da] − [Km], in this exact order. Specifically, let x, y, z be coordinates of Beshium[Bs], Dastarhanium[Da], and Kumysium[Km], respectively, inside the tube. Then, to form a stable combination x ≤ y ≤ z must hold. Note, that the remaining atoms inside the tube do not interact with chosen three in any way.
The output of the reaction mainly depends on the energy level of the Dastarhanium[Da] atom. The expected output for each Dastarhanium[Da] in a reaction is given by the values c_1,c_2,...,c_n. As a result of the reaction all three chosen atoms are destroyed. After that, we can repeat building reactions with the remaining atoms. To prepare a report on large scale production, Erzhan is tasked with choosing which combinations of Beshium[Bs], Dastarhanium[Da] and Kumysium[Km] to use in reactions in such a way to maximize the total energy output.
Input
The first line of the input contains one integer n (1 ≤ n ≤ 10^5) — the number of atoms for each element type.
The second line contains n integers b_1,b_2,··· ,b_n (1 ≤ b_i ≤ 10^9) — coordinates of Beshium[Bs] atoms.
The third line contains n integers k_1,k_2,··· ,k_n (1 ≤ k_i ≤ 10^9) — coordinates of Kumysium[Km] atoms.
The fourth line contains n integers d_1,d_2,··· ,d_n (1 ≤ d_i ≤ 10^9) — coordinates of Dastarhanium[Da] atoms.
The fifth line contains n integers c_1,c_2,··· ,c_n (1 ≤ c_i ≤ 10^9) — the expected energy output for each Dastarhanium[Da] atoms.
Output
Print one number — the maximum possible total energy output that could be achieved for given atom positions.