num = input().split(" ")
vertical = list(map(int, input().split()))
horizontal = list(map(int, input().split()))

xlen = list()
ylen = list()
temp = 0

a = int(num[0])
b = int(num[1])

for i in range(a):
	for j in range(1, a - i):
		xlen.append(abs(vertical[i] - vertical[a - j]))

for i in range(b):
	for j in range(1, b - i):
		ylen.append(abs(horizontal[i] - horizontal[a - j]))

print(xlen)
print(ylen)

for i in range(len(xlen)):
	for j in range(len(ylen)):
		temp += xlen[i] * ylen[j]

ans = temp % (10**9 + 7)

print(ans)
