def main
  n, m = gets.split(" ").map{|v| v.to_i}
  x = gets.split(" ").map{|v| v.to_i}
  y = gets.split(" ").map{|v| v.to_i}

  length_x = []
  (1...x.length).each do |i|
    (0...(x.length - i)).each do |j|
      length_x << (x[j+i] - x[j])
    end
  end

  length_y = []
  (1...y.length).each do |i|
    (0...(y.length - i)).each do |j|
      length_y << (y[j+i] - y[j])
    end
  end

  sum = 0
  length_x.each do |lx|
    length_y.each do |ly|
      sum += lx * ly
    end
  end

  puts (sum % (10**9 + 7))
end

main
