nm = input().split()
n = int(nm[0])
m = int(nm[1])
X = input().split()
Y = input().split()
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 += (int(X[i + j]) - int(X[i])) * (int(Y[k + l]) - int(Y[k]))
ans = S % 1000000007
print(ans)