n, m = map(int, input().split())
X = [int(x) for x in input().split()]
Y = [int(x) for x in input().split()]
p = 10 ** 9 + 7
ans = 0
for i in range(n - 1):
  for j in range(m - 1):
    S = (X[i + 1] - X[i]) * (Y[j + 1] - Y[j]) * (n - i - 1) * (i + 1) * (m - j - 1) * (j + 1)
    ans += S
print(ans % p)