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):
        for k in range(i, N):
            for l in range(j, M):
                SUM = (SUM + (X[k] - X[i]) * (Y[l] - Y[j])) % MOD
print(SUM)