
n,m = gets.split.map{|_|_.to_i}
xs = gets.split.map{|_|_.to_i}
ys = gets.split.map{|_|_.to_i}

divider = 1000_000_007

sum = 0
for xi in 1...n do
	for yi in 1...m do
		k = (xi)*(n-xi) * (yi)*(m-yi)
		sum += (xs[xi]-xs[xi-1]).abs % divider * ((ys[yi]-ys[yi-1]).abs % divider) * k % divider
		sum %= divider
	end
end

puts sum

