gets
x = gets.chomp.split(' ').map(&:to_i)
y = gets.chomp.split(' ').map(&:to_i)

xp = x.product(x).reject { |a, b| a >= b }
yp = y.product(y).reject { |a, b| a >= b }

sum = 0
xp.product(yp).each do |xs, ys|
  sum += (xs[1] - xs[0]) * (ys[1] - ys[0])
end

puts sum % 1_000_000_007
