local mod = 1000000007
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local n, m = io.read("*n", "*n")
local xsum = 0
local xprev = io.read("*n")
for i = 1, n - 1 do
  local xnxt = io.read("*n")
  local len = (xnxt - xprev) % mod
  local mul = bmul(i, n - i)
  xsum = badd(xsum, bmul(mul, len))
  xprev = xnxt
end
local ysum = 0
local yprev = io.read("*n")
for i = 1, m - 1 do
  local ynxt = io.read("*n")
  local len = (ynxt - yprev) % mod
  local mul = bmul(i, m - i)
  ysum = badd(ysum, bmul(mul, len))
  yprev = ynxt
end
print(bmul(xsum, ysum))
