D = 1_000_000_007
N, M = gets.split.map(&:to_i)
X = gets.split.map(&:to_i) 
Y = gets.split.map(&:to_i)

def calc(a)
  return 0 if a.size <= 1
  ((a[0] - a[-1]) * (a.size - 1) % D) + calc(a[1..-2])
end

p calc(X) * calc(Y) % D