n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

a = [abs(x[x1]-x[x2]) for x1 in range(n) for x2 in range(x1+1,n)]
b = [abs(y[x1]-y[x2]) for x1 in range(m) for x2 in range(x1+1,m)]

print (sum(x * y for x in a for y in b) % (10 ** 9 +7))