import sequtils, strutils, algorithm

const
  mo = 1_000_000_007
let
  nm = stdin.readline.split.map(parseInt)
  (n, m) = (nm[0], nm[1])
  xs = stdin.readline.split.map(parseInt).sorted(cmp[int])
  ys = stdin.readline.split.map(parseInt).sorted(cmp[int])
var
  res = 0

for i in 1..<n:
  for j in 1..<m:
    res += (i*j*(n-i)*(m-j) mod mo) * ((xs[i]-xs[i-1])*(ys[j]-ys[j-1]) mod mo) mod mo
    res = res mod mo

echo res
