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):
    t = (X[i+1]-X[i]) * (Y[j+1]-Y[j])
    t %= MOD
    t *= (n-i-1)*(i+1)
    t %= MOD
    t *= (m-j-1)*(j+1)
    t %= MOD
    ans += t
    ans %= MOD
print(ans)