import numpy as np
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
S = np.asarray([[(X[i + 1] - X[i]) * (Y[j + 1] - Y[j]) % p for j in range(m - 1)] for i in range(n - 1)])
m = np.asarray([[(n - i - 1) * (i + 1) * (m - j - 1) * (j + 1) % p for j in range(m - 1)] for i in range(n - 1)])
print(np.sum(S * m) % p)