MOD = 10 ** 9 + 7
N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
SUM = 0

for i in range(N):
    for j in range(M):
        pos = i * j + (N - i - 1) * (M - j - 1)
        neg = i * (M - j - 1) + (N - i - 1) * j
        SUM = (SUM + X[i] * Y[j] * (pos - neg)) % MOD
print(SUM)
