local n,m = io.read("*n", "*n")
local xsum, ysum=0, 0
for i=1,n do
  local x=io.read("*n")
  xsum = xsum + x*(i-1-(n-i))
end
for i=1,m do
  local y=io.read("*n")
  ysum = ysum + y*(i-1-(m-i))
end
print(xsum*ysum%1000000007)