import java.awt.geom.Point2D; import java.io.File; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; import java.util.TreeSet; public class realeastate_artur { static double eps = 1e-9; static int dc(double x, double y) { if (Math.abs(x - y) < eps) return 0; return x < y ? -1 : 1; } public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); PrintStream out = System.out; int n; while ((n = in.nextInt()) != 0) { double[] x1 = new double[n]; double[] y1 = new double[n]; double[] x2 = new double[n]; double[] y2 = new double[n]; TreeSet set = new TreeSet(new Comparator() { @Override public int compare(Double x, Double y) { return dc(x, y); } }); for (int i = 0; i < n; i++) { x1[i] = in.nextDouble(); y1[i] = in.nextDouble(); x2[i] = in.nextDouble(); y2[i] = in.nextDouble(); set.add(x1[i]); set.add(x2[i]); } // Simple O(N*N*logN): // Sweep vertical line L and for each position compute the overlapping length of y-segments in O(NlogN). double result = 0; double left, right = set.pollFirst(), mid; while (!set.isEmpty()) { left = right; right = set.pollFirst(); mid = (left + right) / 2; ArrayList yList = new ArrayList(); for (int i = 0; i < n; i++) if (dc(x1[i], mid) != 1 && dc(mid, x2[i]) != 1) { yList.add(new Point2D.Double(y1[i], -1)); yList.add(new Point2D.Double(y2[i], 1)); } Collections.sort(yList, new Comparator() { @Override public int compare(Point2D.Double a, Point2D.Double b) { if (dc(a.x, b.x) == 0) return dc(a.y, b.y); return dc(a.x, b.x); } }); double length = 0; int k = 0; for (int i = 0; i < yList.size(); i++) { if (k != 0 && i > 0) length += yList.get(i).x - yList.get(i - 1).x; if (yList.get(i).y > 0) k++; else k--; } result += length * (right - left); } out.printf("%.2f\n", result); } } }