def calc_area(p, x, y)
  i, j = p.split.map(&:to_i)
  return (x[i+1] - x[i])*(y[j+1] - y[j])
end

n = gets.to_i

r = []
x = {}
y = {}
n.times{|i|
  r[i] = gets.split.map(&:to_i)
  x[r[i][0]]=1
  y[r[i][1]]=1
  x[r[i][2]]=1
  y[r[i][3]]=1
}

sx = x.keys.sort
xi = {}
sx.each_with_index{|v, i|
  xi[v] = i
}
sy = y.keys.sort
yi = {}
sy.each_with_index{|v, i|
  yi[v] = i
}

mat = {}
n.times{|i|
  xi[r[i][0]].upto(xi[r[i][2]]-1){|j|
    yi[r[i][1]].upto(yi[r[i][3]]-1){|k|
      mat["#{j} #{k}"] = 1
    }
  }
}

sum = 0
mat.each{|k, v|
  sum += calc_area(k, sx, sy)
}
p sum