gets
xs = gets.split(' ').map(&:to_i)
ys = gets.split(' ').map(&:to_i)
r = 0
(1..xs.length-1).each do |w|
  (1..ys.length-1).each do |h|
    (xs.length-w).times do |x|
      (ys.length-h).times do |y|
        r += (xs[x+w] - xs[x]) *
             (ys[y+h] - ys[y])
      end
    end
  end
end

puts r % (10 ** 9 + 7)
