N, M = gets.split.map{|i|i.to_i}
X = gets.split.map{|i|i.to_i}
Y = gets.split.map{|i|i.to_i}
P = 10 ** 9 + 7
sum = 0
(0 .. M / 2 - 1).each{|i|
    (0 .. N / 2 - 1).each{|j|
        s = (M - 1 - i * 2) * (N - 1 - j * 2)
        x = X[N - 1 - j] - X[j]
        y = Y[M - 1 - i] - Y[i]
        sum += s * x * y
        sum %= P
    }
}
puts sum
