n, m = map(int, input().split(" "));
xs = list(map(int, input().split(" ")));
ys = list(map(int, input().split(" ")));
print(xs, ys);

sumx=0;
for i in range(0, n-1):
    for j in range(i+1, n):
        sumx += (xs[j]-xs[i]) % 1000000007

sumy=0;
for i in range(0, m-1):
    for j in range(i+1, m):
        sumx += (ys[j]-ys[i]) % 1000000007

print((sumx*sumy) % 1000000007)
