Power Grid


Shichikuji must supply electricity to nn cities. City ii sits at coordinates (xi,yi)(x_i, y_i).

A city has electricity if it has a power station, or if it is connected (directly or through other cities) to a city that does.

  • Building a power station in city ii costs cic_i.
  • Connecting cities ii and jj with a wire costs (ki+kj)⋅(∣xi−xj∣+∣yi−yj∣)(k_i + k_j) \cdot (|x_i - x_j| + |y_i - y_j|).

Wires run along cardinal directions, so their length is the Manhattan distance between the two cities. Find the minimum cost to give every city electricity.

Input

The first line contains an integer nn.

The next nn lines each contain two integers xix_i and yiy_i.

The next line contains nn integers c1,c2,…,cnc_1, c_2, \ldots, c_n.

The last line contains nn integers k1,k2,…,knk_1, k_2, \ldots, k_n.

Output

Output a single integer: the minimum cost.

Constraints

  • 1≤n≤20001 \le n \le 2000
  • 1≤xi,yi≤1061 \le x_i, y_i \le 10^6
  • 1≤ci,ki≤1091 \le c_i, k_i \le 10^9

Example 1

Input 1
3
2 3
1 1
3 2
3 2 3
3 2 3
Output 1
8
Explanation

Building a station in every city costs 3+2+3=83 + 2 + 3 = 8, which is optimal.

Example 2

Input 2
3
2 1
1 2
3 3
23 2 23
3 2 3
Output 2
27
Explanation

Build a station in city 22 (cost 22), connect 11--22 (cost 1010), and connect 22--33 (cost 1515), for a total of 2727.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.