gets
x = gets.chomp.split(' ').map(&:to_i)
y = gets.chomp.split(' ').map(&:to_i)

# xp = x.product(x).reject { |a, b| a >= b }
# yp = y.product(y).reject { |a, b| a >= b }

# sum = 0
# xp.product(yp).each do |xs, ys|
#   sum += (xs[1] - xs[0]) * (ys[1] - ys[0])
# end

sum = 0
x.each_with_index do |x_item_0, x_index|
  x[(x_index + 1)..-1].each do |x_item_1|
    y.each_with_index do |y_item_0, y_index|
      y[(y_index + 1)..-1].each do |y_item_1|
        sum += (x_item_1 - x_item_0) * (y_item_1 - y_item_0)
      end
    end
  end
end


puts sum % 1_000_000_007
