Given a triplet of integers (X , Y , Z), such that X ≤ Y and Y ≥ Z, we define f(X , Y , Z) to be (X + Y) * (Y + Z). If either X > Y or Y < Z, or both, then f(X , Y , Z) is defined to be 0.
You are provided three arrays  A , B and C   of any length (their lengths may or may not be equal).  
Your task is to find the sum of f(X , Y , Z) over all triplets (X, Y , Z) where   X, Y and Z  belong to  A, B and C respectively.
Output your sum for each test case modulo 1000000007.

-----Input-----
- The first line contains a single integer, T, which is the number of test cases. The description of each testcase follows:
- The first line of each testcase contains 3 integers: p, q and r. These denote the lengths of A,B and C respectively. 
- The second line contains p integers, which are the elements of A
- The third line contains q integers, which are the elements of B
- The fourth line contains r integers, which are the elements of C

-----Output-----
Output the required sum modulo  1000000007  for each test case in a new line.

-----Constraints-----
- 1 ≤ T ≤ 10 
- 1 ≤ p, q, r ≤ 100000 
- 1 ≤ every array element ≤ 1000000000

-----Subtasks  -----
- Subtask #1 (30 points): 1 ≤ p,q,r  ≤ 100 
- Subtask #2 (70 points): 1 ≤ p,q,r  ≤ 100000 

-----Example : -----
Input:
1 
3 1 3
1 2 3
5
4 5 6

Output:
399

-----Explanation: -----
As there is only one choice for Y which equals to 5, to get a non-zero function value,we can choose any element for X from the set { 1 , 2 , 3 } and for Z from the set { 4  , 5 } 
So triplets which give non-zero function values are: 
{ 1 , 5  , 4 } :  ( 1 + 5 ) * ( 5 + 4 )  = 54 
{ 1 , 5  , 5 } :  ( 1 + 5 ) * ( 5 + 5 )  = 60 
{ 2 , 5  , 4 } :  ( 2 + 5 ) * ( 5 + 4 )  = 63 
{ 2 , 5  , 5 } :  ( 2 + 5 ) * ( 5 + 5 )  = 70 
{ 3 , 5  , 4 } :  ( 3 + 5 ) * ( 5 + 4 )  = 72 
{ 3 , 5  , 5 } :  ( 3 + 5 ) * ( 5 + 5 )  = 80 
Final answer : 54 + 60 + 63 + 70 + 72 + 80  = 399

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'testcases = int(input())\r\nwhile testcases > 0:\r\n    array_length = list(map(int,input().split()))\r\n    array1 = list(map(int,input().split()))\r\n    array2 = list(map(int, input().split()))\r\n    array3 = list(map(int, input().split()))\r\n    sum = 0\r\n    for i in range(array_length[0]):\r\n        for j in range(array_length[1]):\r\n            if array1[i] <= array2[j]:\r\n                 for k in range(array_length[2]):\r\n                    if array2[j] >= array3[k] :\r\n                        sum = (sum + (((array1[i] + array2[j]) % 1000000007 )*((array2[j]+array3[k]) % 1000000007))) % 1000000007\r\n    print(sum%1000000007)\r\n    testcases -= 1'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13513