import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
n, m = lr()
X = np.array(lr())
Y = np.array(lr())
x_len = X[1:] - X[:-1]
y_len = Y[1:] - Y[:-1]

square = x_len[:, None] * y_len[None, :]
answer = 0
for i in range(n-1):
    answer += (square[i] % MOD).sum()
    answer %= MOD

answer *= (n-1) * (m-1)
print(answer%MOD)
# 43