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

sumx=0;
sumy=0;
answer=0;
for i in range(0, n-1):
    for j in range(i+1, n):
        for k in range(0, m-1):
            for L in range(k+1, m):
                answer = (((xs[j]-xs[i])%modula) * ((ys[L]-ys[k])%modula)) % modula

print(answer);

