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):
	for j in range(n - i):
		for k in range(m):
			for l in range(m - k):
				S += (X[i + j] - X[i]) * (Y[k + l] - Y[k])
ans = S % 1000000007
print(ans)