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, :] % MOD
answer = (n-1) * (m-1) * square.sum() % MOD
print(answer%MOD)
# 43