n,m = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)
y = gets.split.map(&:to_i)
s = 0
for i in 0..n-2
  for j in 0..m-2
    for k in i+1..n-1
      for l in j+1..m-1
        s += (x[k]-x[i])*(y[l]-y[j])
      end
    end
  end
end

puts s%(10**9+7)
