def calc_area(p, dx, dy)
  i, j = p.split.map(&:to_i)
  return dx[i]*dy[j]
end

n = gets.to_i

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

sx = x.keys.sort
dx = []
xi = {}
sx.each_with_index{|v, i|
  xi[v] = i
  dx[i] = sx[i+1] - sx[i] if i < sx.size-1
}
sy = y.keys.sort
yi = {}
dy = []
sy.each_with_index{|v, i|
  yi[v] = i
  dy[i] = sy[i+1] - sy[i] if i < sx.size-1
}

mat = {}
rec.each{|r, v|
  xi[r[0]].upto(xi[r[2]]-1){|j|
    yi[r[1]].upto(yi[r[3]]-1){|k|
      mat["#{j} #{k}"] = 1
    }
  }
}

sum = 0
mat.each{|k, v|
  i,j = k.split.map(&:to_i)
  sum += dx[i] * dy[j]
}
p sum