#Lutece3380. Yet Another Sum Problem
Yet Another Sum Problem
Description
Given an integer array whose length is and an integer array whose length is . Calculate
$$\sum_{i=1}^n\sum_{j=1}^m\sum_{k=1}^n\sum_{l=1}^m \max\{(s_i+t_j)-(s_k+t_l)+1,0\} $$Input
The first line contains two integers ().
The second line contains integers ().
The third line contains integers ().
It's guaranteed that and .
Output
Output one integer indicating the answer. Please output the answer modulo .
Samples
3 3
1 1 3
1 2 3
106
Resources
The 22nd UESTC Programming Contest Preliminary