nm = input().split()
n = int(nm[0])
m = int(nm[1])
X = input().split()
Y = input().split()
X = map(int, X)
X = list(X)
Y = map(int, Y)
Y = list(Y)
S = 0
for i in range(n - 1):
	x1 = X[i]
	x2 = X[i + 1]
	for j in range(m - 1):
		s = (x2 - x1) * (Y[j + 1] - Y[j])
		s = (i + 1) * (n - i - 1) * (j + 1) * (m - j - 1) * s
		S += s
ans = S % 1000000007
print(ans)