import itertools

n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

total = 0
for S in itertools.combinations(A, 2):
    for T in itertools.combinations(B, 2):
        total += (S[1] - S[0]) * (T[1] - T[0])
        total = total % 1000000007
print(total)