Consider a grid graph: the vertices are lined up into a grid of H rows by W columns. Let us denote the vertex in the i-th row and j-th column as (i,j).
To define the weights of the graph edges, we will consider four non-decreasing sequences, A, B, C, and D, consisting of H−1, W, H, and W−1 positive integers, respectively:
Find the total weight of the edges in the minimal spanning tree of this graph.
The first line of input contains two positive integers H and W (2≤H,W≤105).
The second line contains H−1 integers A_i: the elements of the sequence A.
The third line contains W integers B_i: the elements of the sequence B.
The fourth line contains H integers C_i: the elements of the sequence C.
The fifth line contains W−1 integers D_i: the elements of the sequence D.
It is guaranteed that A_i−1≤A_i, B_i−1≤B_i, C_i−1≤C_i, and D_i−1≤D_i for i>1, and additionally, 1≤A_i,B_i,C_i,D_i≤106.
Print the total weight of the edges in the minimal spanning tree of the given graph. Note that the answer may not fit into a 32-bit integer.