r1 = gets.split.map &:to_i
r2 = gets.split.map &:to_i
r1x = (r1[0]...r1[0] + r1[2])
r1y = (r1[1]...r1[1] + r1[3])
r2x = (r2[0]...r2[0] + r2[2])
r2y = (r2[1]...r2[1] + r2[3])
ans = 0
2000.times do |y|
	2000.times do |x|
		b1 = r1x.include?(x) && r1y.include?(y)
		b2 = r2x.include?(x) && r2y.include?(y)
		ans += 1 if (b1 && !b2) || (!b1 && b2)
	end
end
puts ans

