// Arup Guha
// 9/1/2026
// Solution to Kattis Problem: Page Layout

import java.util.*;

class rectangle {
	
	private int x;
	private int y;
	private int w;
	private int h;
	
	public rectangle(int myx, int myy, int myw, int myh) {
		x = myx;
		y = myy;
		w = myw;
		h = myh;
	}
	
	// Returns true if this and other have positive area intersection.
	public boolean intersect(rectangle other) {
	
		// Other is right of this.
		if (other.x >= x+w) return false;
		
		// this is right of other.
		if (x >= other.x + other.w) return false;
		
		// other is below this.
		if (other.y >= y+h) return false;
		
		// this is below other.
		if (y >= other.y+other.h) return false;
		
		// If we get here, they must intersect.
		return true;
	}
	
	// Returns the area of this rectangle.
	public int area() {
		return w*h;
	}

}

public class pagelayout {

	public static int n;
	public static rectangle[] rList;
	public static boolean[][] intersect;
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		
		// Process cases.
		while (n != 0) {
		
			// Read in the rectangles.
			rList = new rectangle[n];
			for (int i=0; i<n; i++) {
				int w = stdin.nextInt();
				int h = stdin.nextInt();
				int x = stdin.nextInt();
				int y = stdin.nextInt();
				rList[i] = new rectangle(x, y, w, h);
			}
			
			// Pre-comp.
			intersect = new boolean[n][n];
			for (int i=0; i<n; i++) {
				for (int j=i+1; j<n; j++) {
					intersect[i][j] = rList[i].intersect(rList[j]);
					intersect[j][i] = intersect[i][j];
				}
			}
			
			// Solve it.
			int res = go(0, 0, 0);
			System.out.println(res);
		
			// Get next case.
			n = stdin.nextInt();
		}
	}
	
	// Returns the best answer given that we are considering rectangle k, have
	// currently filled an area of area by using the rectangles in mask.
	public static int go(int k, int area, int mask) {
		
		// We're done considering rectangles.
		if (k == n) return area;
		
		// Don't use this rectangle.
		int res = go(k+1, area, mask);
		
		// Now can we use this one.
		boolean use = true;
		
		// We just need to check with conflict with rectangles k-1 or less.
		for (int i=0; i<k; i++) {
			
			// Not in current set.
			if (( mask & (1<<i) ) == 0) continue;
			
			// These conflict.
			if (intersect[k][i]) {
				use = false;
				break;
			}
		}
		
		// Skipping doomed to fail cases.
		if (use) res = Math.max(res, go(k+1, area + rList[k].area(), mask + (1<<k) ));
		
		// Ta da!
		return res;
	}
}