You are given three arrays: a containing n_a elements, b containing n_b elements and c containing n_c elements. These arrays are sorted in non-decreasing order: that is, for every i such that 1≤i<n_a we have a_i≤a_i+1, for every j such that 1≤j<n_b we have b_j≤b_j+1, and for every k such that 1≤k<n_c we have c_k≤c_k+1.
Your task is to calculate the number of triples (i,j,k) such that ∣a_i−b_j∣≤d, ∣a_i−c_k∣≤d, and ∣b_j−c_k∣≤d.
The input contains one or more test cases. Each test case consists of four lines.
The first line of each test case contains four integers: d, n_a, n_b, and n_c (1≤d≤109, 1≤n_a,n_b,n_c≤5⋅105).
The second line contains n_a integers a_1,a_2,…,a_n_a: the array a (−109≤a_i≤109).
The third line contains n_b integers b_1,b_2,…,b_n_b: the array b (−109≤b_i≤109).
The fourth line contains n_c integers c_1,c_2,…,c_n_c: the array c (−109≤c_i≤109).
All arrays are sorted in non-decreasing order. The total sum of n_a over all testcases does not exceed 5⋅105. The total sum of n_b over all testcases does not exceed 5⋅105. The total sum of all n_c over all testcases does not exceed 5⋅105. The test cases just follow one another without any special separators.
For each test case, print a single integer: the number of triples (i,j,k) such that ∣a_i−b_j∣≤d, ∣a_i−c_k∣≤d, and ∣b_j−c_k∣≤d.