n,m = gets.split.map &:to_i
x = gets.split.map &:to_i
y = gets.split.map &:to_i

s = 0

(n-1).times{|i|
	((i+1)..(n-1)).each{|j|
		xx = x[j] - x[i]
		(m-1).times{|k|
			((k+1)..(m-1)).each{|l|
				yy = y[l] - y[k]
				s += xx * yy
			}
		}
		s %= 1000000007
	}
}

puts s % 1000000007