n,m = map(int, raw_input().split())
xls = map(int, raw_input().split())
yls = map(int, raw_input().split())
ans = 0
for x in range(n-1):
    for y in range(m-1):
        ans += (xls[x+1] -xls[x]) * (yls[y+1] - yls[y]) * (x+1) * (n-x-1) * (y+1) * (m-y-1)
        ans %= 10**9 + 7
print ans
