n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9+7

ans = 0
for i in range(n-1):
    for j in range(m-1):
        s = ((x[i+1] - x[i])*(y[j+1] - y[j]))%mod
        ans = (ans + s * (((i+1) * (n-i-1))%mod) * (((j+1) * (m-j-1))%mod)) % mod

print(ans)
