A. Three Arrays
time limit per test
2 seconds
memory limit per test
256 mebibytes
input
standard input
output
standard output

You are given three arrays: a containing na elements, b containing nb elements and c containing nc elements. These arrays are sorted in non-decreasing order: that is, for every i such that 1 ≤ i < na we have ai ≤ ai + 1, for every j such that 1 ≤ j < nb we have bj ≤ bj + 1, and for every k such that 1 ≤ k < nc we have ck ≤ ck + 1.

Your task is to calculate the number of triples (i, j, k) such that |ai - bj| ≤ d, |ai - ck| ≤ d, and |bj - ck| ≤ d.

Input

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, na, nb, and nc (1 ≤ d ≤ 109, 1 ≤ na, nb, nc ≤ 5·105).

The second line contains na integers a1, a2, ..., ana: the array a ( - 109 ≤ ai ≤ 109).

The third line contains nb integers b1, b2, ..., bnb: the array b ( - 109 ≤ bi ≤ 109).

The fourth line contains nc integers c1, c2, ..., cnc: the array c ( - 109 ≤ ci ≤ 109).

All arrays are sorted in non-decreasing order. The total sum of na over all testcases does not exceed 5·105. The total sum of nb over all testcases does not exceed 5·105. The total sum of all nc over all testcases does not exceed 5·105. The test cases just follow one another without any special separators.

Output

For each test case, print a single integer: the number of triples (i, j, k) such that |ai - bj| ≤ d, |ai - ck| ≤ d, and |bj - ck| ≤ d.

Example
Input
1 3 3 3
1 2 3
1 2 3
1 2 3
1 6 6 6
1 1 2 2 3 3
2 2 3 3 4 4
3 3 4 4 5 5
Output
15
56