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

sum = 0
xs.combination(2).each do |x|
	ys.combination(2).each do |y|
		sum += ((x[1]-x[0]).abs % 1000_000_007) * ((y[1]-y[0]).abs % 1000_000_007)
		sum %= 1000_000_007
	end
end

puts sum
