<reponame>kagemeka/atcoder-submissions
from itertools import combinations

mod = int(1e9 + 7)
n, m = [int(num) for num in input().split()]

x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]

sumx = 0
for cmb in combinations(x, 2):
    sumx += (cmb[1] - cmb[0]) % mod

sumy = 0
for cmb in combinations(y, 2):
    sumy += (cmb[1] - cmb[0]) % mod

ans = sumx * sumy % mod

print(ans)

from itertools import combinations

mod = int(1e9 + 7)
n, m = [int(num) for num in input().split()]

x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]

sumx = 0
for cmb in combinations(x, 2):
    sumx += (cmb[1] - cmb[0]) % mod

sumy = 0
for cmb in combinations(y, 2):
    sumy += (cmb[1] - cmb[0]) % mod

ans = sumx * sumy % mod

print(ans)