n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10 ** 9 + 7

x0 = 0
for i in range(n - 1):
    x0 += (x[i + 1] - x[i]) * (i + 1) * (n - i - 1)
    x0 %= mod
y0 = 0
for i in range(m - 1):
    y0 += (y[i + 1] - y[i]) * (i + 1) * (m - i - 1)
    y0 %= mod
print(x0 * y0 % mod)