One very important person has a piece of paper in the form of a rectangle a × b.

Also, he has n seals. Each seal leaves an impression on the paper in the form of a rectangle of the size x_{i} × y_{i}. Each impression must be parallel to the sides of the piece of paper (but seal can be rotated by 90 degrees).

A very important person wants to choose two different seals and put them two impressions. Each of the selected seals puts exactly one impression. Impressions should not overlap (but they can touch sides), and the total area occupied by them should be the largest possible. What is the largest area that can be occupied by two seals?


-----Input-----

The first line contains three integer numbers n, a and b (1 ≤ n, a, b ≤ 100).

Each of the next n lines contain two numbers x_{i}, y_{i} (1 ≤ x_{i}, y_{i} ≤ 100).


-----Output-----

Print the largest total area that can be occupied by two seals. If you can not select two seals, print 0.


-----Examples-----
Input
2 2 2
1 2
2 1

Output
4

Input
4 10 9
2 3
1 1
5 10
9 11

Output
56

Input
3 10 10
6 6
7 7
20 5

Output
0



-----Note-----

In the first example you can rotate the second seal by 90 degrees. Then put impression of it right under the impression of the first seal. This will occupy all the piece of paper.

In the second example you can't choose the last seal because it doesn't fit. By choosing the first and the third seals you occupy the largest area.

In the third example there is no such pair of seals that they both can fit on a piece of paper.

Source: codeforces | Difficulty: MEDIUM
Tags: Implementation

Complete search


Solutions:
MINUS_INF = -10 ** 9

def solve(w, h, stamps):
	res = MINUS_INF
	for (i, s1) in enumerate(stamps):
		for s2 in stamps[i + 1:]:
			if fit(w, h, s1, s2):
				res = max(res, s1[0] * s1[1] + s2[0] * s2[1])
	res = max(res, 0)
	return res

def fit(w, h, s1, s2):
	return subfit(w, h, s1, s2) or subfit(w, h, rev(s1), s2) or subfit(w, h, s1, rev(s2)) or subfit(h, w, s1, s2)

def subfit(w, h, s1, s2):
	return s1[0] + s2[0] <= w and s1[1] <= h and (s2[1] <= h) or (s1[1] + s2[1] <= h and s1[0] <= w and (s2[0] <= w))

def rev(s):
	return (s[1], s[0])
(n, w, h) = map(int, input().split())
stamps = [tuple(map(int, input().split())) for i in range(n)]
print(solve(w, h, stamps))


[n, a, b] = [int(x) for x in input().split()]
[a, b] = sorted([a, b])
matrix = [[[0, 1], [0, 1]]]
sizes = []
for i in range(n):
	sizes.append([int(x) for x in input().split()])
max_area = 0
for x in range(1, n):
	for y in range(x):
		s0 = sizes[x]
		s1 = sizes[y]
		total_area = s1[0] * s1[1] + s0[0] * s0[1]
		combined_size = sorted([max(s0[0], s1[0]), s0[1] + s1[1]])
		if combined_size[0] <= a and combined_size[1] <= b:
			max_area = max(max_area, total_area)
		combined_size = sorted([max(s0[0], s1[1]), s0[1] + s1[0]])
		if combined_size[0] <= a and combined_size[1] <= b:
			max_area = max(max_area, total_area)
		combined_size = sorted([max(s0[1], s1[0]), s0[0] + s1[1]])
		if combined_size[0] <= a and combined_size[1] <= b:
			max_area = max(max_area, total_area)
		combined_size = sorted([max(s0[1], s1[1]), s0[0] + s1[0]])
		if combined_size[0] <= a and combined_size[1] <= b:
			max_area = max(max_area, total_area)
print(max_area)


from dataclasses import dataclass
from itertools import combinations

@dataclass
class Seal:
	width: int
	height: int

	@property
	def area(self):
		return self.width * self.height

	def fits(self, other):
		return other.width <= self.width and other.height <= self.height or (other.height <= self.width and other.width <= self.height)

	@property
	def valid(self):
		return self.width >= 0 and self.height >= 0
(n, paper_width, paper_height) = map(int, input().split())
paper = Seal(paper_width, paper_height)
seals = [*combinations((Seal(*map(int, input().split())) for _ in range(n)), 2)]
seals.sort(key=lambda p: p[0].area + p[1].area, reverse=True)
area = 0
for (i, (first, second)) in enumerate(seals):
	subsections = list()
	rem_width = paper_width - first.width
	rem_height = paper_height - first.height
	if rem_width >= 0 and rem_height >= 0:
		subsections.extend((Seal(rem_width, paper_height), Seal(paper_width, rem_height)))
	rem_width_rot = paper_width - first.height
	rem_height_rot = paper_height - first.width
	if rem_width_rot >= 0 and rem_height_rot >= 0:
		subsections.extend((Seal(rem_width_rot, paper_height), Seal(paper_width, rem_height_rot)))
	for seal in subsections:
		if seal.fits(second):
			area = first.area + second.area
			break
	else:
		continue
	break
print(area)


(n, a, b) = list(map(int, input().split()))
l = []
for i in range(0, n):
	l1 = []
	(x, y) = list(map(int, input().split()))
	l1.append(x * y)
	l1.append(x)
	l1.append(y)
	l.append(l1)
l.sort()
m = 0
for i in range(0, n):
	for j in range(i + 1, n):
		if l[i][0] + l[j][0] <= a * b and (max(l[i][1], l[j][1]) <= min(a, b) and l[i][2] + l[j][2] <= max(a, b) or (max(l[i][1], l[j][2]) <= min(a, b) and l[i][2] + l[j][1] <= max(a, b)) or (max(l[i][2], l[j][1]) <= min(a, b) and l[i][1] + l[j][2] <= max(a, b)) or (max(l[i][2], l[j][2]) <= min(a, b) and l[i][1] + l[j][1] <= max(a, b))):
			if l[i][0] + l[j][0] > m:
				m = l[i][0] + l[j][0]
		elif l[i][0] + l[j][0] <= a * b and (max(l[i][1], l[j][1]) <= max(a, b) and l[i][2] + l[j][2] <= min(a, b) or (max(l[i][1], l[j][2]) <= max(a, b) and l[i][2] + l[j][1] <= min(a, b)) or (max(l[i][2], l[j][1]) <= max(a, b) and l[i][1] + l[j][2] <= min(a, b)) or (max(l[i][2], l[j][2]) <= max(a, b) and l[i][1] + l[j][1] <= min(a, b))):
			if l[i][0] + l[j][0] > m:
				m = l[i][0] + l[j][0]
print(m)


(n, a, b) = map(int, input().split())
x = list(range(n))
y = list(range(n))
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		if x[i] + x[j] <= b and max(y[i], y[j]) <= a or (y[i] + y[j] <= a and max(x[i], x[j]) <= b):
			ans = max(ans, x[i] * y[i] + x[j] * y[j])
		(x[i], y[i]) = (y[i], x[i])
		if x[i] + x[j] <= b and max(y[i], y[j]) <= a or (y[i] + y[j] <= a and max(x[i], x[j]) <= b):
			ans = max(ans, x[i] * y[i] + x[j] * y[j])
		(x[j], y[j]) = (y[j], x[j])
		if x[i] + x[j] <= b and max(y[i], y[j]) <= a or (y[i] + y[j] <= a and max(x[i], x[j]) <= b):
			ans = max(ans, x[i] * y[i] + x[j] * y[j])
		(x[i], y[i]) = (y[i], x[i])
		if x[i] + x[j] <= b and max(y[i], y[j]) <= a or (y[i] + y[j] <= a and max(x[i], x[j]) <= b):
			ans = max(ans, x[i] * y[i] + x[j] * y[j])
		(x[j], y[j]) = (y[j], x[j])
print(ans)


def try_fit(X, Y, x1, y1, x2, y2):
	if x1 > X or y1 > Y:
		return False
	newX = X - x1
	newY = Y - y1
	return x2 <= newX and y2 <= Y or (x2 <= X and y2 <= newY)
(n, a, b) = map(int, input().split())
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	l.append((x, y))
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1) = l[i]
		(x2, y2) = l[j]
		if try_fit(a, b, x1, y1, x2, y2) or try_fit(a, b, y1, x1, x2, y2) or try_fit(a, b, x1, y1, y2, x2) or try_fit(a, b, y1, x1, y2, x2):
			ans = max(ans, x1 * y1 + x2 * y2)
print(ans)


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, a, b) = M()
l = []
for i in range(n):
	(x, y) = M()
	l.append((x, y, x * y))
m = 0
for i in range(n):
	for j in range(n):
		if i != j:
			x = l[i]
			y = l[j]
			if max(x[0], y[0]) <= a and x[1] + y[1] <= b:
				m = max(m, x[2] + y[2])
			if max(x[0], y[1]) <= a and x[1] + y[0] <= b:
				m = max(m, x[2] + y[2])
			if max(x[1], y[0]) <= a and x[0] + y[1] <= b:
				m = max(m, x[2] + y[2])
			if max(x[1], y[1]) <= a and x[0] + y[0] <= b:
				m = max(m, x[2] + y[2])
			if max(x[0], y[0]) <= b and x[1] + y[1] <= a:
				m = max(m, x[2] + y[2])
			if max(x[0], y[1]) <= b and x[1] + y[0] <= a:
				m = max(m, x[2] + y[2])
			if max(x[1], y[0]) <= b and x[0] + y[1] <= a:
				m = max(m, x[2] + y[2])
			if max(x[1], y[1]) <= b and x[0] + y[0] <= a:
				m = max(m, x[2] + y[2])
print(m)


def check(a, b, x1, y1, x2, y2):
	if x1 + x2 <= a and max(y1, y2) <= b:
		return 1
	if x1 + y2 <= a and max(y1, x2) <= b:
		return 1
	if x1 + x2 <= b and max(y1, y2) <= a:
		return 1
	if y1 + x2 <= a and max(x1, y2) <= b:
		return 1
	if max(x1, x2) <= a and y1 + y2 <= b:
		return 1
	if max(x1, y2) <= a and y1 + x2 <= b:
		return 1
	if max(x1, x2) <= b and y1 + y2 <= a:
		return 1
	if max(y1, x2) <= a and x1 + y2 <= b:
		return 1
	return 0
(n, a, b) = map(int, input().split())
ps = []
for i in range(n):
	ps.append([int(x) for x in input().split()])
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		if check(a, b, ps[i][0], ps[i][1], ps[j][0], ps[j][1]):
			ans = max(ans, ps[i][0] * ps[i][1] + ps[j][0] * ps[j][1])
print(ans)


(n, a, b) = map(int, input().split())
cachet = [list(map(int, input().split())) for i in range(n)]
cachet.sort(key=lambda el: el[0] * el[1])
cachet.reverse()
maxim = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		p1 = cachet[i]
		p2 = cachet[j]
		s = p1[0] * p1[1] + p2[0] * p2[1]
		if p1[0] + p2[0] <= a and max(p1[1], p2[1]) <= b or (p1[0] + p2[0] <= b and max(p1[1], p2[1]) <= a):
			if s > maxim:
				maxim = s
			break
		elif p1[1] + p2[0] <= a and max(p1[0], p2[1]) <= b or (p1[1] + p2[0] <= b and max(p1[0], p2[1]) <= a):
			if s > maxim:
				maxim = s
			break
		elif p1[0] + p2[1] <= a and max(p1[1], p2[0]) <= b or (p1[0] + p2[1] <= b and max(p1[1], p2[0]) <= a):
			if s > maxim:
				maxim = s
			break
		elif p1[1] + p2[1] <= a and max(p1[0], p2[0]) <= b or (p1[1] + p2[1] <= b and max(p1[0], p2[0]) <= a):
			if s > maxim:
				maxim = s
			break
print(maxim)


def check(l):
	nonlocal a, b, s, ans
	if min(l) <= min(a, b) and max(l) <= max(a, b):
		ans = max(ans, s)
ans = 0
x = []
y = []
(n, a, b) = list(map(int, input().split()))
for _ in range(n):
	(xi, yi) = list(map(int, input().split()))
	x.append(xi)
	y.append(yi)
ans = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		s = x[i] * y[i] + x[j] * y[j]
		check([max(x[i], x[j]), y[i] + y[j]])
		check([max(x[i], y[j]), y[i] + x[j]])
		check([max(y[i], x[j]), x[i] + y[j]])
		check([max(y[i], y[j]), x[i] + x[j]])
		check([x[i] + x[j], y[i] + y[j]])
		check([x[i] + y[j], y[i] + x[j]])
print(ans)


(n, a, b) = map(int, input().split())
l = [[int(j) for j in input().split()] for i in range(n)]
ms = 0
for i in range(n):
	for j in range(i + 1, n):
		if l[i][0] + l[j][0] <= a and max(l[i][1], l[j][1]) <= b:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][1] + l[j][1] <= a and max(l[i][0], l[j][0]) <= b:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][0] + l[j][1] <= a and max(l[i][1], l[j][0]) <= b:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][1] + l[j][0] <= a and max(l[i][0], l[j][1]) <= b:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][0] + l[j][0] <= b and max(l[i][1], l[j][1]) <= a:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][1] + l[j][1] <= b and max(l[i][0], l[j][0]) <= a:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][0] + l[j][1] <= b and max(l[i][1], l[j][0]) <= a:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
		if l[i][1] + l[j][0] <= b and max(l[i][0], l[j][1]) <= a:
			ms = max(ms, l[i][0] * l[i][1] + l[j][0] * l[j][1])
print(ms)


(n, a, b) = map(int, input().split())
mas = [[0, 0] for i in range(n)]
for i in range(n):
	mas[i] = list(map(int, input().split()))

def f(i1, j1, i2, j2):
	if i1 <= a and j1 <= b and (i2 <= a) and (j2 <= b):
		if j1 + j2 > b and i1 + i2 > a:
			return 0
		return i1 * j1 + i2 * j2
	return 0
ans = 0
for i in range(n):
	for j in range(n):
		if i != j:
			ans = max(ans, f(mas[i][0], mas[i][1], mas[j][0], mas[j][1]))
			ans = max(ans, f(mas[i][1], mas[i][0], mas[j][0], mas[j][1]))
			ans = max(ans, f(mas[i][0], mas[i][1], mas[j][1], mas[j][0]))
			ans = max(ans, f(mas[i][1], mas[i][0], mas[j][1], mas[j][0]))
print(ans)


(n, a, b) = map(int, input().split())
d = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		if i != j:
			tmp = d[i][0] * d[i][1] + d[j][0] * d[j][1]
			for x1 in range(2):
				for x2 in range(2):
					if max(d[i][x1], d[j][x2]) <= b and d[i][1 - x1] + d[j][1 - x2] <= a:
						ans = max(ans, tmp)
					if max(d[i][x1], d[j][x2]) <= a and d[i][1 - x1] + d[j][1 - x2] <= b:
						ans = max(ans, tmp)
print(ans)


f = lambda : map(int, input().split())
(n, a, b) = f()
(p, s) = (0, a + b)
t = [((x, y), x * y, x + y) for (x, y) in [f() for i in range(n)]]
for (k, (qo, po, so)) in enumerate(t, 1):
	for (qk, pk, sk) in t[k:]:
		if any((i + j <= d <= s - max(so - i, sk - j) for i in qo for j in qk for d in [a, b])):
			p = max(p, po + pk)
print(p)


(n, a, b) = map(int, input().split())
if n > 1:
	if a > b:
		(a, b) = (b, a)
	seals = [None] * n
	count = 0
	for i in range(n):
		seal = list(map(int, input().split()))
		if seal[0] > seal[1]:
			(seal[0], seal[1]) = (seal[1], seal[0])
		if seal[0] <= a and seal[1] < b or (seal[0] < a and seal[1] <= b):
			seals[count] = seal
			count += 1
	if count > 1:
		max_area = a * b
		area = 0
		for i in range(count):
			for j in range(i + 1, count):
				if seals[i][0] + seals[j][0] <= a or seals[i][1] + seals[j][1] <= b or seals[i][0] + seals[j][1] <= a or (seals[i][1] + seals[j][0] <= b and seals[j][1] <= a) or (seals[i][1] + seals[j][0] <= a) or (seals[i][0] + seals[j][1] <= b and seals[i][1] <= a) or (seals[i][1] + seals[j][1] <= a) or (seals[i][0] + seals[j][0] <= b and seals[i][1] <= a and (seals[j][1] <= a)):
					area_temp = seals[i][0] * seals[i][1] + seals[j][0] * seals[j][1]
					if area_temp <= max_area:
						if area_temp == max_area:
							print(max_area)
							exit()
						area = max(area, area_temp)
		print(area)
	else:
		print(0)
else:
	print(0)


def main():
	(n, a, b) = [int(t) for t in input().split()]
	points = []
	for _ in range(n):
		point = [int(t) for t in input().split()]
		points.append(point)
	largest_area = 0
	for (i, (x1, y1)) in enumerate(points):
		for (j, (x2, y2)) in enumerate(points):
			if i == j:
				continue
			if satisfy(x1, y1, x2, y2, a, b):
				area = x1 * y1 + x2 * y2
				largest_area = max(area, largest_area)
	print(largest_area)

def satisfy(x1, y1, x2, y2, a, b):
	if satisfy_single(max((x1, x2)), sum((y1, y2)), a, b):
		return True
	if satisfy_single(sum((x1, x2)), max((y1, y2)), a, b):
		return True
	if satisfy_single(max((x1, y2)), sum((y1, x2)), a, b):
		return True
	if satisfy_single(sum((x1, y2)), max((y1, x2)), a, b):
		return True
	if satisfy_single(max((y1, x2)), sum((x1, y2)), a, b):
		return True
	if satisfy_single(sum((y1, x2)), max((x1, y2)), a, b):
		return True
	return False

def satisfy_single(x, y, a, b):
	if x <= a and y <= b:
		return True
	if x <= b and y <= a:
		return True
	return False

def __starting_point():
	main()
__starting_point()


(n, a, b) = map(int, input().split())
seal = []
for i in range(n):
	seal.append(list(map(int, input().split())))
ma = 0
for i in range(n - 1):
	j = i + 1
	while j < n:
		l = []
		m = seal[i][0] * seal[i][1] + seal[j][0] * seal[j][1]
		(x, y) = (seal[i][0] + seal[j][0], max(seal[i][1], seal[j][1]))
		if max(x, y) <= max(a, b) and min(x, y) <= min(a, b):
			ma = max(ma, m)
		(x, y) = (seal[i][0] + seal[j][1], max(seal[i][1], seal[j][0]))
		if max(x, y) <= max(a, b) and min(x, y) <= min(a, b):
			ma = max(ma, m)
		(x, y) = (seal[i][1] + seal[j][0], max(seal[i][0], seal[j][1]))
		if max(x, y) <= max(a, b) and min(x, y) <= min(a, b):
			ma = max(ma, m)
		(x, y) = (seal[i][1] + seal[j][1], max(seal[i][0], seal[j][0]))
		if max(x, y) <= max(a, b) and min(x, y) <= min(a, b):
			ma = max(ma, m)
		j += 1
print(ma)


(n, a, b) = list(map(int, input().strip().split()))
coo = []
for i in range(n):
	(x, y) = list(map(int, input().strip().split()))
	coo.append((x, y))
m = 0
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1) = coo[i]
		(x2, y2) = coo[j]
		flag = False
		c = max(x1, x2)
		d = y1 + y2
		if min(c, d) <= min(a, b) and max(c, d) <= max(a, b):
			flag = True
		c = max(x1, y2)
		d = y1 + x2
		if min(c, d) <= min(a, b) and max(c, d) <= max(a, b):
			flag = True
		c = max(x2, y1)
		d = x1 + y2
		if min(c, d) <= min(a, b) and max(c, d) <= max(a, b):
			flag = True
		c = max(y1, y2)
		d = x1 + x2
		if min(c, d) <= min(a, b) and max(c, d) <= max(a, b):
			flag = True
		if flag:
			m = max(m, x1 * y1 + x2 * y2)
print(m)


import sys

def check(a, b, x, y, q, w):
	if x + q <= a and max(y, w) <= b:
		return True
	if y + w <= b and max(x, q) <= a:
		return True
	return False

def main():
	(n, a, b) = map(int, sys.stdin.readline().split())
	t = []
	for i in range(n):
		(x, y) = map(int, sys.stdin.readline().split())
		if (x > a or y > b) and (x > b or y > a):
			pass
		else:
			t.append((x, y))
	ans = 0
	for i in range(len(t)):
		for j in range(i + 1, len(t)):
			if check(a, b, t[i][0], t[i][1], t[j][0], t[j][1]) or check(a, b, t[i][0], t[i][1], t[j][1], t[j][0]) or check(a, b, t[i][1], t[i][0], t[j][1], t[j][0]) or check(a, b, t[i][1], t[i][0], t[j][0], t[j][1]):
				c = t[i][0] * t[i][1] + t[j][0] * t[j][1]
				if c > ans:
					ans = c
	print(ans)
main()


def coExist(s1, s2, a, b):
	if s1[0] > a or s1[1] > b or s2[0] > a or (s2[1] > b):
		return False
	if s1[0] + s2[0] <= a and s2[1] <= b:
		return True
	if s1[1] + s2[1] <= b and s2[0] <= a:
		return True
(n, a, b) = [int(x) for x in input().split()]
seals = []
for i in range(n):
	(x, y) = [int(z) for z in input().split()]
	seals.append((x, y))
mxAr = 0
for i in range(n):
	seal = (seals[i][0], seals[i][1])
	for j in range(i + 1, n):
		if coExist(seal, (seals[j][0], seals[j][1]), a, b):
			mxAr = max(mxAr, seal[0] * seal[1] + seals[j][0] * seals[j][1])
		if coExist(seal, (seals[j][1], seals[j][0]), a, b):
			mxAr = max(mxAr, seal[0] * seal[1] + seals[j][0] * seals[j][1])
	seal = (seals[i][1], seals[i][0])
	for j in range(i + 1, n):
		if coExist(seal, (seals[j][0], seals[j][1]), a, b):
			mxAr = max(mxAr, seal[0] * seal[1] + seals[j][0] * seals[j][1])
		if coExist(seal, (seals[j][1], seals[j][0]), a, b):
			mxAr = max(mxAr, seal[0] * seal[1] + seals[j][0] * seals[j][1])
print(mxAr)


(n, a, b) = list(map(int, input().split()))
x = []
y = []
for i in range(n):
	(h, m) = list(map(int, input().split()))
	x.append(h)
	y.append(m)
k = 0
(a, b) = (min(a, b), max(a, b))
for i in range(n):
	for j in range(i + 1, n):
		(h1, m1) = (min(x[i], y[i]), max(x[i], y[i]))
		(h2, m2) = (min(x[j], y[j]), max(x[j], y[j]))
		if max(h1, h2) <= a and m1 + m2 <= b:
			k = max(k, h1 * m1 + h2 * m2)
		if max(m1, h2) <= a and h1 + m2 <= b or (max(m1, h2) <= b and h1 + m2 <= a):
			k = max(k, h1 * m1 + h2 * m2)
		if max(h1, m2) <= a and m1 + h2 <= b or (max(h1, m2) <= b and m1 + h2 <= a):
			k = max(k, h1 * m1 + h2 * m2)
		if max(m1, m2) <= a and h1 + h2 <= b or (max(m1, m2) <= b and h1 + h2 <= a):
			k = max(k, h1 * m1 + h2 * m2)
print(k)


(n, a, b) = map(int, input().split())
A = []
for i in range(n):
	A.append(list(map(int, input().split())))

def sqr(f, s):
	for i in range(3):
		if a >= f[0] + s[0] and b >= max(f[1], s[1]) or (b >= f[0] + s[0] and a >= max(f[1], s[1])):
			return f[0] * f[1] + s[0] * s[1]
		elif a >= max(f[0], s[0]) and b >= f[1] + s[1] or (b >= max(f[0], s[0]) and a >= f[1] + s[1]):
			return f[0] * f[1] + s[0] * s[1]
		elif i == 0:
			(f[0], f[1]) = (f[1], f[0])
		elif i == 1:
			(f[0], f[1]) = (f[1], f[0])
			(s[0], s[1]) = (s[1], s[0])
	return 0
maxi = 0
for i in range(n):
	for j in range(n):
		if i != j:
			maxi = max(maxi, sqr(A[i], A[j]))
print(maxi)


def cal(x1, y1, x2, y2, a, b):
	return x1 + x2 <= a and max(y1, y2) <= b
(n, a, b) = map(int, input().split())
xy = []
for i in range(n):
	(x, y) = map(int, input().split())
	xy.append((x, y))
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		for p1 in range(2):
			for p2 in range(2):
				if cal(xy[i][p1], xy[i][1 - p1], xy[j][p2], xy[j][1 - p2], a, b) or cal(xy[i][p1], xy[i][1 - p1], xy[j][p2], xy[j][1 - p2], b, a):
					ans = max(ans, xy[i][0] * xy[i][1] + xy[j][0] * xy[j][1])
print(ans)


import sys
input = sys.stdin.readline

def cal(r1, r2, a, b):
	if r1[0] <= a and r1[1] <= b:
		if r2[0] <= a - r1[0] and r2[1] <= b or (r2[1] <= a - r1[0] and r2[0] <= b):
			return r1[0] * r1[1] + r2[0] * r2[1]
		if r2[0] <= a and r2[1] <= b - r1[1] or (r2[1] <= a and r2[0] <= b - r1[1]):
			return r1[0] * r1[1] + r2[0] * r2[1]
	(a, b) = (b, a)
	if r1[0] <= a and r1[1] <= b:
		if r2[0] <= a - r1[0] and r2[1] <= b or (r2[1] <= a - r1[0] and r2[0] <= b):
			return r1[0] * r1[1] + r2[0] * r2[1]
		if r2[0] <= a and r2[1] <= b - r1[1] or (r2[1] <= a and r2[0] <= b - r1[1]):
			return r1[0] * r1[1] + r2[0] * r2[1]
	return 0
(n, a, b) = map(int, input().split())
arr = []
MAX = 0
for i in range(n):
	arr.append(list(map(int, input().split())))
for i in range(n):
	for j in range(i + 1, n):
		MAX = max(MAX, cal(arr[i], arr[j], a, b))
print(MAX)


(n, A, B) = map(int, input().split())
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	l.append((x, y))

def checkList(a, b):
	return a <= A and b <= B or (b <= A and a <= B)

def checkPear(ax, ay, bx, by):
	return checkList(ax + bx, max(ay, by)) or checkList(ax + by, max(ay, bx)) or checkList(ay + by, max(ax, bx)) or checkList(ay + bx, max(ax, by))
maxs = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if checkPear(*l[i], *l[j]):
			could_be = l[i][0] * l[i][1] + l[j][0] * l[j][1]
			maxs = max(could_be, maxs)
print(maxs)


def check(x, y, a, b):
	return min(x, y) <= min(a, b) and max(x, y) <= max(a, b)
(n, a, b) = map(int, input().split())
p = []
for i in range(n):
	(xi, yi) = map(int, input().split())
	p.append((xi, yi))
ans = 0
for i in range(n):
	for j in range(i):
		(x1, y1) = p[i]
		(x2, y2) = p[j]
		if check(max(x1, x2), y1 + y2, a, b) or check(max(x1, y2), x2 + y1, a, b) or check(max(y1, x2), x1 + y2, a, b) or check(max(y1, y2), x1 + x2, a, b):
			ans = max(ans, x1 * y1 + x2 * y2)
print(ans)


def check_fit_seal(grid, seal):
	if grid[0] >= seal[0] and grid[1] >= seal[1]:
		return True
	else:
		return False

def check_fit_seals(grid, seal1, seal2):
	ans = False
	if check_fit_seal(grid, seal1):
		ans = ans or check_fit_seal((grid[0] - seal1[0], grid[1]), seal2)
		ans = ans or check_fit_seal((grid[0], grid[1] - seal1[1]), seal2)
		ans = ans or check_fit_seal((grid[0] - seal1[0], grid[1]), (seal2[1], seal2[0]))
		ans = ans or check_fit_seal((grid[0], grid[1] - seal1[1]), (seal2[1], seal2[0]))
	seal1 = (seal1[1], seal1[0])
	if check_fit_seal(grid, seal1):
		ans = ans or check_fit_seal((grid[0] - seal1[0], grid[1]), seal2)
		ans = ans or check_fit_seal((grid[0], grid[1] - seal1[1]), seal2)
		ans = ans or check_fit_seal((grid[0] - seal1[0], grid[1]), (seal2[1], seal2[0]))
		ans = ans or check_fit_seal((grid[0], grid[1] - seal1[1]), (seal2[1], seal2[0]))
	return ans
(n, a, b) = [int(i) for i in input().strip().split(' ')]
seals = []
for _ in range(n):
	seals.append([int(i) for i in input().strip().split(' ')])
max_area = 0
for (i, seal1) in enumerate(seals):
	for (j, seal2) in enumerate(seals):
		if i != j:
			if check_fit_seals((a, b), seal1, seal2):
				max_area = max(max_area, seal1[0] * seal1[1] + seal2[0] * seal2[1])
print(max_area)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, a, b) = map(int, input().split())
c = list()
for i in range(n):
	(x, y) = map(int, input().split())
	c.append((x, y))
m = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		x1 = c[i][0]
		y1 = c[i][1]
		x2 = c[j][0]
		y2 = c[j][1]
		if x1 <= a and x2 <= a and (y1 <= b) and (y2 <= b) and (x1 + x2 <= a or y1 + y2 <= b) or (x1 <= a and y2 <= a and (y1 <= b) and (x2 <= b) and (x1 + y2 <= a or y1 + x2 <= b)) or (y1 <= a and x2 <= a and (x1 <= b) and (y2 <= b) and (y1 + x2 <= a or x1 + y2 <= b)) or (y1 <= a and y2 <= a and (x1 <= b) and (x2 <= b) and (y1 + y2 <= a or x1 + x2 <= b)):
			m = max(m, x1 * y1 + x2 * y2)
print(m)


(n, a, b) = map(int, input().split())
(lst, res) = ([], 0)
for i in range(n):
	lst.append(list(map(int, input().split())))
for (i, x) in enumerate(lst):
	for (j, y) in enumerate(lst):
		if i != j:
			(a1, b1, a2, b2) = (x[0], x[1], y[0], y[1])
			if max(a1, a2) <= a and b1 + b2 <= b:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(a1, a2) <= b and b1 + b2 <= a:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(b1, b2) <= a and a1 + a2 <= b:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(b1, b2) <= b and a1 + a2 <= a:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(a1, b2) <= a and b1 + a2 <= b:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(a1, b2) <= b and b1 + a2 <= a:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(b1, a2) <= a and a1 + b2 <= b:
				res = max(res, a1 * b1 + a2 * b2)
				continue
			if max(b1, a2) <= b and a1 + b2 <= a:
				res = max(res, a1 * b1 + a2 * b2)
print(res)


import sys
from itertools import product
(n, a, b) = map(int, input().split())
seal = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		for ((w1, h1), (w2, h2)) in product(((seal[i][0], seal[i][1]), (seal[i][1], seal[i][0])), ((seal[j][0], seal[j][1]), (seal[j][1], seal[j][0]))):
			if w1 + w2 <= a and max(h1, h2) <= b or (max(w1, w2) <= a and h1 + h2 <= b):
				ans = max(ans, w1 * h1 + w2 * h2)
print(ans)


(n, a, b) = map(int, input().split())
l = []

def find(x1, y1, x2, y2, a, b):
	t = x1 * y1 + x2 * y2
	if x1 + x2 <= a and y1 <= b and (y2 <= b) or (y1 + y2 <= b and x1 <= a and (x2 <= a)):
		return t
	else:
		return 0
for i in range(n):
	l.append(list(map(int, input().split())))
ans = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		(first, second) = (l[i], l[j])
		curans1 = find(first[0], first[1], second[0], second[1], a, b)
		curans2 = find(first[1], first[0], second[0], second[1], a, b)
		curans3 = find(first[0], first[1], second[1], second[0], a, b)
		curans4 = find(first[1], first[0], second[1], second[0], a, b)
		cur = max(curans1, curans2, curans3, curans4)
		if cur > ans:
			ans = cur
print(ans)


(n, a, b) = map(int, input().split(' '))
seals = []
for i in range(n):
	seals.append(list(map(int, input().split(' '))))

def canFit(rect, a, b):
	(x1, x2) = (max(a, b), min(a, b))
	(y1, y2) = (max(rect[0], rect[1]), min(rect[0], rect[1]))
	return x1 >= y1 and x2 >= y2
seals.sort(key=lambda x: -x[0] * x[1])
best = 0
for i in range(n):
	for j in range(i + 1, n):
		first = [seals[i][0] + seals[j][0], max(seals[i][1], seals[j][1])]
		second = [seals[i][0] + seals[j][1], max(seals[i][1], seals[j][0])]
		third = [max(seals[i][0], seals[j][0]), seals[i][1] + seals[j][1]]
		fourth = [max(seals[i][0], seals[j][1]), seals[i][1] + seals[j][0]]
		if canFit(first, a, b) or canFit(second, a, b) or canFit(third, a, b) or canFit(fourth, a, b):
			best = max(best, seals[i][0] * seals[i][1] + seals[j][0] * seals[j][1])
print(best)


(n, w, h) = list(map(int, input().split()))

def chk(w1, h1, w2, h2):
	if w1 <= w and h1 <= h:
		if w - w1 >= w2 and h >= h2 or (w - w1 >= h2 and h >= w2) or (w >= w2 and h - h1 >= h2) or (w >= h2 and h - h1 >= w2):
			return True
	if h1 <= w and w1 <= h:
		if w - h1 >= w2 and h >= h2 or (w - h1 >= h2 and h >= w2) or (w >= w2 and h - w1 >= h2) or (w >= h2 and h - w1 >= w2):
			return True
	return False
(a, ans) = ([], 0)
for i in range(n):
	(x, y) = list(map(int, input().split()))
	a.append([x, y])
for i in range(n):
	for j in range(i + 1, n):
		if a[i][0] * a[i][1] + a[j][1] * a[j][0] > ans and chk(a[i][0], a[i][1], a[j][0], a[j][1]):
			ans = a[i][0] * a[i][1] + a[j][1] * a[j][0]
print(ans)


from operator import itemgetter
(n, a, b) = list(map(int, input().split()))
l = [0] * n
counter = 0
answers = [0]
for i in range(n):
	l[i] = list(map(int, input().split()))
for i in range(n):
	l[i].append(l[i][0] * l[i][1])
l.sort(key=itemgetter(2), reverse=True)
for i in range(len(l)):
	counter += 1
	if l[i][0] * l[i][1] >= a * b:
		continue
	if i == len(l) - 1:
		break
	for k in range(counter, len(l)):
		if l[i][0] * l[i][1] + l[k][0] * l[k][1] <= a * b:
			if l[i][0] + l[k][0] <= a and max(l[i][1], l[k][1]) <= b:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][0] + l[k][1] <= a and max(l[i][1], l[k][0]) <= b:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][1] + l[k][0] <= a and max(l[i][0], l[k][1]) <= b:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][1] + l[k][1] <= a and max(l[i][0], l[k][0]) <= b:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][0] + l[k][0] <= b and max(l[i][1], l[k][1]) <= a:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][0] + l[k][1] <= b and max(l[i][1], l[k][0]) <= a:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][1] + l[k][0] <= b and max(l[i][0], l[k][1]) <= a:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
			elif l[i][1] + l[k][1] <= b and max(l[i][0], l[k][0]) <= a:
				ansew = l[i][0] * l[i][1] + l[k][0] * l[k][1]
				answers.append(ansew)
print(max(answers))


import sys
(n, a, b) = list(map(int, input().split()))
x = []
y = []
for i in range(n):
	(x1, y1) = list(map(int, input().split()))
	x.append(x1)
	y.append(y1)
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		s = x[i] * y[i] + x[j] * y[j]
		if x[i] + x[j] <= a and max(y[i], y[j]) <= b:
			ans = max(ans, s)
		if x[i] + x[j] <= b and max(y[i], y[j]) <= a:
			ans = max(ans, s)
		if x[i] + y[j] <= a and max(y[i], x[j]) <= b:
			ans = max(ans, s)
		if x[i] + y[j] <= b and max(y[i], x[j]) <= a:
			ans = max(ans, s)
		if y[i] + y[j] <= a and max(x[i], x[j]) <= b:
			ans = max(ans, s)
		if y[i] + y[j] <= b and max(x[i], x[j]) <= a:
			ans = max(ans, s)
		if y[i] + x[j] <= a and max(x[i], y[j]) <= b:
			ans = max(ans, s)
		if y[i] + x[j] <= b and max(x[i], y[j]) <= a:
			ans = max(ans, s)
print(ans)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left, bisect
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
(n, a, b) = map(int, input().split())
l = []
for _ in range(n):
	l.append(list(map(int, input().split())))
m = 0
for i in range(n):
	for j in range(i + 1, n):
		if l[i][0] + l[j][0] <= a and max(l[i][1], l[j][1]) <= b or (l[i][0] + l[j][1] <= a and max(l[i][1], l[j][0]) <= b) or (l[i][1] + l[j][0] <= a and max(l[i][0], l[j][1]) <= b) or (l[i][1] + l[j][1] <= a and max(l[i][0], l[j][0]) <= b) or (l[i][0] + l[j][0] <= b and max(l[i][1], l[j][1]) <= a) or (l[i][0] + l[j][1] <= b and max(l[i][1], l[j][0]) <= a) or (l[i][1] + l[j][0] <= b and max(l[i][0], l[j][1]) <= a) or (l[i][1] + l[j][1] <= b and max(l[i][0], l[j][0]) <= a):
			m = max(m, l[i][0] * l[i][1] + l[j][0] * l[j][1])
print(m)


(n, a, b) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
mx = 0
for i in range(n):
	for j in range(i + 1, n):
		if xy[i][0] + xy[j][0] <= a and max(xy[i][1], xy[j][1]) <= b or (xy[i][1] + xy[j][0] <= a and max(xy[i][0], xy[j][1]) <= b) or (xy[i][1] + xy[j][1] <= a and max(xy[i][0], xy[j][0]) <= b) or (xy[i][0] + xy[j][1] <= a and max(xy[i][1], xy[j][0]) <= b) or (xy[i][0] + xy[j][0] <= b and max(xy[i][1], xy[j][1]) <= a) or (xy[i][1] + xy[j][0] <= b and max(xy[i][0], xy[j][1]) <= a) or (xy[i][1] + xy[j][1] <= b and max(xy[i][0], xy[j][0]) <= a) or (xy[i][0] + xy[j][1] <= b and max(xy[i][1], xy[j][0]) <= a):
			mx = max(xy[i][0] * xy[i][1] + xy[j][0] * xy[j][1], mx)
print(mx)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(n, a, b) = map(int, input().split())
x = [-1 for i in range(n)]
y = [-1 for i in range(n)]
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
ans = 0
for i in range(n):
	for j in range(n):
		if i == j:
			continue
		if x[i] + x[j] <= a:
			if max(y[i], y[j]) <= b:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if x[i] + x[j] <= b:
			if max(y[i], y[j]) <= a:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if x[i] + y[j] <= a:
			if max(y[i], x[j]) <= b:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if x[i] + y[j] <= b:
			if max(y[i], x[j]) <= a:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if y[i] + y[j] <= a:
			if max(x[i], x[j]) <= b:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if y[i] + y[j] <= b:
			if max(x[i], x[j]) <= a:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if y[i] + x[j] <= a:
			if max(x[i], y[j]) <= b:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
		if y[i] + x[j] <= b:
			if max(x[i], y[j]) <= a:
				ans = max(ans, x[i] * y[i] + x[j] * y[j])
print(ans)


(n, A, B) = map(int, input().split())
arr = []
for x in range(n):
	(i, j) = map(int, input().split())
	arr.append([i, j])
ans = int(0)
i = int(0)
j = int(0)
for i in range(n):
	for j in range(i + 1, n):
		a = arr[i][0]
		b = arr[i][1]
		c = arr[j][0]
		d = arr[j][1]
		temp = a * b + c * d
		if temp <= ans:
			continue
		if b + d <= B and max(a, c) <= A or (max(b, d) <= B and a + c <= A) or (b + c <= B and max(a, d) <= A) or (max(b, c) <= B and a + d <= A) or (a + d <= B and max(c, b) <= A) or (max(a, d) <= B and c + b <= A) or (a + c <= B and max(b, d) <= A) or (max(a, c) <= B and b + d <= A):
			ans = max(ans, temp)
print(ans)


ans = [0]

def an(x1, y1, x2, y2):
	if x1 + x2 <= a and max(y1, y2) <= b or (y1 + y2 <= b and max(x1, x2) <= a):
		ans.append(x1 * y1 + x2 * y2)
(n, a, b) = map(int, input().split())
arr = []
for i in range(n):
	(x, y) = map(int, input().split())
	arr.append([x, y])
for i in range(n):
	for j in range(i + 1, n):
		(x1, y1, x2, y2) = (arr[i][0], arr[i][1], arr[j][0], arr[j][1])
		an(x1, y1, x2, y2)
		an(y1, x1, x2, y2)
		an(x1, y1, y2, x2)
		an(y1, x1, y2, x2)
print(max(ans))


import re, sys
(n, a, b) = list(map(int, input().split()))
d = [tuple(map(int, input().split())) for i in range(n)]

def f(a, b, d):
	ans = []
	if a <= d[0] and b <= d[1]:
		ans.append((d[0] - a, d[1]))
		ans.append((d[0], d[1] - b))
	(a, b) = (b, a)
	if a <= d[0] and b <= d[1]:
		ans.append((d[0] - a, d[1]))
		ans.append((d[0], d[1] - b))
	return ans
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		for t in f(d[i][0], d[i][1], (a, b)):
			if len(f(d[j][0], d[j][1], t)):
				ans = max(ans, d[i][0] * d[i][1] + d[j][0] * d[j][1])
print(ans)


(n, a, b) = map(int, input().split())
ps = []
for i in range(n):
	ps.append(tuple(map(int, input().split())))
res = 0

def is_ok(p, a, b):
	return p[0] <= a and p[1] <= b or (p[0] <= b and p[1] <= a)

def is_pair_ok(p1, p2):
	an = a - p1[0]
	bn = b - p1[1]
	if an < 0 or bn < 0:
		return False
	return is_ok(p2, bn, a) or is_ok(p2, an, b)
for (i1, p1) in enumerate(ps):
	for (i2, p2) in enumerate(ps):
		if i1 == i2:
			continue
		cres = p1[0] * p1[1] + p2[0] * p2[1]
		if is_pair_ok(p1, p2) or is_pair_ok((p1[1], p1[0]), p2):
			res = max(cres, res)
print(res)


(n, a, b) = map(int, input().split())
s = [0] * n
for i in range(n):
	s[i] = tuple(map(int, input().split()))
ans = 0
for i in range(n):
	if s[i][0] > a and s[i][1] > b and (s[i][0] > b) and (s[i][1] > a):
		continue
	cur = [s[i][0], s[i][1]]
	for orientation in range(2):
		(cur[0], cur[1]) = (cur[1], cur[0])
		rest = [(a - cur[0], b), (a, b - cur[1])]
		if cur[0] <= a and cur[1] <= b:
			for j in range(i + 1, n):
				cur2 = [s[j][0], s[j][1]]
				for orientation2 in range(2):
					(cur2[0], cur2[1]) = (cur2[1], cur2[0])
					for pair in rest:
						if cur2[0] <= pair[0] and cur2[1] <= pair[1]:
							res = cur[0] * cur[1] + cur2[0] * cur2[1]
							ans = max(ans, res)
print(ans)


import sys, math
(n, a, b) = map(int, input().split())
x = [0 for i in range(n)]
y = [0 for i in range(n)]
for i in range(n):
	(u, v) = map(int, input().split())
	x[i] = u
	y[i] = v
m = 0
for i in range(n):
	for j in range(n):
		if i != j:
			if x[i] + x[j] <= a and max(y[i], y[j]) <= b or (x[i] + y[j] <= a and max(y[i], x[j]) <= b) or (y[i] + x[j] <= a and max(x[i], y[j]) <= b) or (y[i] + y[j] <= a and max(x[i], x[j]) <= b) or (x[i] + x[j] <= b and max(y[i], y[j]) <= a) or (x[i] + y[j] <= b and max(y[i], x[j]) <= a) or (y[i] + x[j] <= b and max(x[i], y[j]) <= a) or (y[i] + y[j] <= b and max(x[i], x[j]) <= a):
				if m < x[i] * y[i] + x[j] * y[j]:
					m = x[i] * y[i] + x[j] * y[j]
print(m)


R = lambda : list(map(int, input().split()))
(n, a, b) = R()
xy = [R() for _ in range(n)]
ans = 0

def f(xy1, xy2):
	tans = 0
	for _ in range(2):
		for __ in range(2):
			if xy1[0] + xy2[0] <= a and max(xy1[1], xy2[1]) <= b or (max(xy1[0], xy2[0]) <= a and xy1[1] + xy2[1] <= b):
				tans = max(tans, xy1[0] * xy1[1] + xy2[0] * xy2[1])
			(xy2[0], xy2[1]) = (xy2[1], xy2[0])
		(xy1[0], xy1[1]) = (xy1[1], xy1[0])
	return tans
for i in range(n):
	for j in range(i + 1, n):
		ans = max(ans, f(xy[i], xy[j]))
print(ans)


def pred(h, w, y1, x1, y2, x2):
	return y1 + y2 <= h and x1 <= w and (x2 <= w) or (x1 + x2 <= w and y1 <= h and (y2 <= h))

def main():
	(n, h, w) = map(int, input().split())
	y = [None] * n
	x = [None] * n
	for i in range(n):
		(y[i], x[i]) = map(int, input().split())
	ans = 0
	for i in range(n):
		for j in range(i):
			if pred(h, w, y[i], x[i], y[j], x[j]) or pred(h, w, y[i], x[i], x[j], y[j]) or pred(h, w, x[i], y[i], y[j], x[j]) or pred(h, w, x[i], y[i], x[j], y[j]):
				ans = max(ans, y[i] * x[i] + y[j] * x[j])
	print(ans)
main()


(n, a, b) = map(int, input().split())
t = []
for i in range(n):
	t.append(list(map(int, input().split())))
m = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		(x1, y1) = (t[i][0], t[i][1])
		(x2, y2) = (t[j][0], t[j][1])
		c = x1 + x2
		d = max(y1, y2)
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		c = max(x1, x2)
		d = y1 + y2
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		(x2, y2) = (y2, x2)
		c = x1 + x2
		d = max(y1, y2)
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		c = max(x1, x2)
		d = y1 + y2
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		(x1, y1) = (y1, x1)
		(x2, y2) = (t[j][0], t[j][1])
		c = x1 + x2
		d = max(y1, y2)
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		c = max(x1, x2)
		d = y1 + y2
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		(x2, y2) = (y2, x2)
		c = x1 + x2
		d = max(y1, y2)
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
		c = max(x1, x2)
		d = y1 + y2
		if c <= a and d <= b:
			if x1 * y1 + x2 * y2 > m:
				m = x1 * y1 + x2 * y2
print(m)


(test_no, a, b) = map(int, input().split(' '))
c = [0.0 for x in range(test_no)]
d = [0.0 for y in range(test_no)]
for i in range(0, test_no):
	(c[i], d[i]) = map(int, input().split(' '))
area = 0
e = 0
f = 0
for i in range(0, test_no - 1):
	for j in range(i + 1, test_no):
		if c[i] + c[j] <= a and d[j] <= b and (d[i] <= b) or (c[i] + d[j] <= a and c[j] <= b and (d[i] <= b)) or (c[j] + d[i] <= a and c[i] <= b and (d[j] <= b)) or (d[i] + d[j] <= a and c[j] <= b and (c[i] <= b)) or (c[i] + c[j] <= b and d[j] <= a and (d[i] <= a)) or (c[i] + d[j] <= b and c[j] <= a and (d[i] <= a)) or (c[j] + d[i] <= b and c[i] <= a and (d[j] <= a)) or (d[i] + d[j] <= b and c[j] <= a and (c[i] <= a)):
			e = c[i] * d[i] + c[j] * d[j]
		if e > f:
			f = e
	if f > area:
		area = f
print(area)


(n, a, b) = map(int, input().split())
s = []
for i in range(n):
	(x, y) = map(int, input().split())
	s.append((x, y, x * y))
t = 0
for i in range(n):
	for j in range(i):
		if s[i][0] + s[j][0] <= a and s[i][1] <= b and (s[j][1] <= b) or (s[i][1] + s[j][0] <= a and s[i][0] <= b and (s[j][1] <= b)) or (s[i][0] + s[j][1] <= a and s[i][1] <= b and (s[j][0] <= b)) or (s[i][1] + s[j][1] <= a and s[i][0] <= b and (s[j][0] <= b)):
			t = max(t, s[i][2] + s[j][2])
		(a, b) = (b, a)
		if s[i][0] + s[j][0] <= a and s[i][1] <= b and (s[j][1] <= b) or (s[i][1] + s[j][0] <= a and s[i][0] <= b and (s[j][1] <= b)) or (s[i][0] + s[j][1] <= a and s[i][1] <= b and (s[j][0] <= b)) or (s[i][1] + s[j][1] <= a and s[i][0] <= b and (s[j][0] <= b)):
			t = max(t, s[i][2] + s[j][2])
		(a, b) = (b, a)
print(t)


def valid(x1, x2, y1, y2):
	if x1 + x2 <= X and max(y1, y2) <= Y:
		return True
	if max(x1, x2) <= X and y1 + y2 <= Y:
		return True
	return False
(n, X, Y) = map(int, input().split())
lis = []
for i in range(n):
	(x, y) = map(int, input().split())
	lis.append([x, y])
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		(a, b) = lis[i]
		(c, d) = lis[j]
		if valid(a, c, b, d) or valid(a, d, b, c) or valid(b, d, a, c) or valid(b, c, a, d):
			ans = max(a * b + c * d, ans)
print(ans)


def sm(obj1, obj2):
	return obj1[0] * obj1[1] + obj2[0] * obj2[1]

def rotate(x, y, obj):
	if obj[0] > x or obj[1] > y:
		return -1
	else:
		return 1

def can_put(x, y, obj):
	if obj[0] > x and obj[0] > y or (obj[1] > x and obj[1] > y):
		return False
	else:
		return True

def can_add(x, y, obj1, obj2):
	if obj1[0] <= x and obj1[1] <= y:
		if obj1[1] + obj2[1] <= y and obj2[0] <= x:
			return True
		elif obj1[0] + obj2[0] <= x and obj2[1] <= y:
			return True
		else:
			return False
	else:
		return False

def add(x, y, obj1, obj2, ms):
	if can_put(x, y, obj1) and can_put(x, y, obj2):
		lm = sm(obj1, obj2)
		if lm > x * y or lm < ms:
			return False
		r = rotate(x, y, obj1)
		if can_add(x, y, obj1[::r], obj2):
			return True
		elif can_add(x, y, obj1[::r], obj2[::-1]):
			return True
		elif can_add(x, y, obj1[::-r], obj2):
			return True
		elif can_add(x, y, obj1[::-r], obj2[::-1]):
			return True
		else:
			return False
	else:
		return False
(lst, m) = ([], 0)
(n, a, b) = map(int, input().split())
for i in range(n):
	lst += [[int(j) for j in input().split()]]
for i in range(n - 1):
	for j in range(i + 1, n):
		if add(a, b, lst[i], lst[j], m):
			m = sm(lst[i], lst[j])
print(m)


f = lambda : map(int, input().split())
(n, a, b) = f()
c = a + b
(s, t) = (0, [list(f()) for i in range(n)])
h = [(i, j, d) for i in [0, 1] for j in [0, 1] for d in [a, b]]
for (k, u) in enumerate(t, 1):
	for v in t[k:]:
		if not all((u[i] + v[j] > d or max(u[1 - i], v[1 - j]) > c - d for (i, j, d) in h)):
			s = max(s, u[0] * u[1] + v[0] * v[1])
print(s)


(k, n, m) = map(int, input().split())
(x, y) = ([], [])
for i in range(k):
	(q, p) = map(int, input().split())
	x.append(min(q, p))
	y.append(max(q, p))
MAX = 0
for i in range(k):
	for j in range(i + 1, k):
		ok = False
		if x[i] + x[j] <= n and y[i] <= m and (y[j] <= m):
			ok = True
		elif x[i] + y[j] <= n and y[i] <= m and (x[j] <= m):
			ok = True
		elif y[i] + y[j] <= m and x[i] <= n and (x[j] <= n):
			ok = True
		elif y[i] + x[j] <= m and x[i] <= n and (y[j] <= n):
			ok = True
		elif y[i] + y[j] <= n and x[i] <= m and (x[j] <= m):
			ok = True
		elif y[i] + x[j] <= n and x[i] <= m and (y[j] <= m):
			ok = True
		elif x[i] + x[j] <= m and y[i] <= n and (y[j] <= n):
			ok = True
		elif x[i] + y[j] <= m and y[i] <= n and (x[j] <= n):
			ok = True
		if ok:
			MAX = max(MAX, x[i] * y[i] + x[j] * y[j])
print(MAX)


(n, width, height) = map(int, input().split())
stamp = []
max_s = 0

def set_stamp(stamp_1_width, stamp_1_height, stamp_2_width, stamp_2_height):
	global max_s
	s = stamp_1_width * stamp_1_height + stamp_2_width * stamp_2_height
	if stamp_1_height + stamp_2_height > height and stamp_1_width + stamp_2_width > width:
		return
	if stamp_1_width + stamp_2_width <= width:
		if stamp_1_height > height or stamp_2_height > height:
			return
	if stamp_1_height + stamp_2_height <= height:
		if stamp_1_width > width or stamp_2_width > width:
			return
	if s > max_s:
		max_s = s
for i in range(n):
	(w, h) = map(int, input().split())
	stamp.append((w, h))
for it_first_stamp in range(n):
	for it_second_stamp in range(n):
		if it_second_stamp != it_first_stamp:
			set_stamp(stamp[it_first_stamp][0], stamp[it_first_stamp][1], stamp[it_second_stamp][0], stamp[it_second_stamp][1])
			set_stamp(stamp[it_first_stamp][0], stamp[it_first_stamp][1], stamp[it_second_stamp][1], stamp[it_second_stamp][0])
			set_stamp(stamp[it_first_stamp][1], stamp[it_first_stamp][0], stamp[it_second_stamp][0], stamp[it_second_stamp][1])
			set_stamp(stamp[it_first_stamp][1], stamp[it_first_stamp][0], stamp[it_second_stamp][1], stamp[it_second_stamp][0])
print(max_s)


import sys
(n, a, b) = map(int, input().split())
p = []
for i in range(n):
	p.append(list(map(int, input().split())))
sMax = 0
for i in range(n - 1):
	j = i + 1
	while j < n:
		l = []
		nSq = p[i][0] * p[i][1] + p[j][0] * p[j][1]
		(s1, s2) = (p[i][0] + p[j][0], max(p[i][1], p[j][1]))
		if max(s1, s2) <= max(a, b) and min(s1, s2) <= min(a, b):
			sMax = max(sMax, nSq)
		(s1, s2) = (p[i][0] + p[j][1], max(p[i][1], p[j][0]))
		if max(s1, s2) <= max(a, b) and min(s1, s2) <= min(a, b):
			sMax = max(sMax, nSq)
		(s1, s2) = (p[i][1] + p[j][0], max(p[i][0], p[j][1]))
		if max(s1, s2) <= max(a, b) and min(s1, s2) <= min(a, b):
			sMax = max(sMax, nSq)
		(s1, s2) = (p[i][1] + p[j][1], max(p[i][0], p[j][0]))
		if max(s1, s2) <= max(a, b) and min(s1, s2) <= min(a, b):
			sMax = max(sMax, nSq)
		j += 1
print(sMax)


def compatible(arr1, arr2, a, b):
	l = arr1[0]
	m = arr1[1]
	n = arr2[0]
	o = arr2[1]
	as_it_is = l + n <= a and m <= b and (o <= b) or (m + o <= b and l <= a and (n <= a))
	l = arr1[1]
	m = arr1[0]
	rot_first = l + n <= a and m <= b and (o <= b) or (m + o <= b and l <= a and (n <= a))
	l = arr1[0]
	m = arr1[1]
	n = arr2[1]
	o = arr2[0]
	rot_sec = l + n <= a and m <= b and (o <= b) or (m + o <= b and l <= a and (n <= a))
	l = arr1[1]
	m = arr1[0]
	n = arr2[1]
	o = arr2[0]
	rot_both = l + n <= a and m <= b and (o <= b) or (m + o <= b and l <= a and (n <= a))
	return as_it_is or rot_first or rot_sec or rot_both

def main():
	(n, a, b) = [int(num) for num in input().split(' ')]
	rects = []
	for i in range(n):
		(x, y) = [int(num) for num in input().split(' ')]
		rects.append([x, y])
	inds = []
	for i in range(0, len(rects)):
		inds.append([rects[i][0] * rects[i][1] + rects[j][0] * rects[j][1] for j in range(i + 1, len(rects)) if compatible(rects[i], rects[j], a, b)])
	m = 0
	for ind in inds:
		for more in ind:
			if more > m:
				m = more
	print(m)
main()


(n, a, b) = list(map(int, input().split(' ')))
seals = []
for x in range(n):
	seals.append(list(map(int, input().split(' '))))
maxt = 0
ls = [a, b]

def condition(x, y):
	for i in [0, 1]:
		for j in [0, 1]:
			for k in [0, 1]:
				if x[i] + y[j] <= ls[k] and x[1 - i] <= ls[1 - k] and (y[1 - j] <= ls[1 - k]):
					return True
	return False
for x in seals:
	for y in seals:
		if x is not y and condition(x, y):
			total = x[0] * x[1] + y[0] * y[1]
			maxt = max(maxt, total)
print(maxt)


(n, a, b) = input().split(' ')
n = int(n)
a = int(a)
b = int(b)
x = []
y = []
for i in range(n):
	(tx, ty) = input().split(' ')
	x.append(int(tx))
	y.append(int(ty))
for i in range(n):
	for j in range(n):
		if x[i] * y[i] > x[j] * y[j]:
			tmp = x[i]
			x[i] = x[j]
			x[j] = tmp
			tmp = y[i]
			y[i] = y[j]
			y[j] = tmp
res = []
for i in range(n - 1):
	for j in range(i + 1, n):
		if x[i] + x[j] <= a and y[i] <= b and (y[j] <= b) or (x[i] + x[j] <= b and y[i] <= a and (y[j] <= a)) or (y[i] + y[j] <= a and x[i] <= b and (x[j] <= b)) or (y[i] + y[j] <= b and x[i] <= a and (x[j] <= a)) or (x[i] + y[j] <= a and x[j] <= b and (y[i] <= b)) or (y[i] + x[j] <= a and x[i] <= b and (y[j] <= b)) or (x[i] + y[j] <= b and y[i] <= a and (x[j] <= a)) or (y[i] + x[j] <= b and x[i] <= a and (y[j] <= a)):
			res.append(x[i] * y[i] + x[j] * y[j])
if len(res) > 0:
	print(max(res))
	quit()
print(0)


def ldc(nt, mt, a, b):
	index = 0
	if nt >= a and mt >= b:
		index = 1
	elif nt >= b and mt >= a:
		index = 1
	if index == 1:
		return 1
	else:
		return 0
(t, n, m) = map(int, input().split())
list_a = []
list_b = []
list_s = []
max_s = 0
for i in range(t):
	(a, b) = map(int, input().split())
	list_a.append(a)
	list_b.append(b)
	list_s.append(a * b)
for i in range(t):
	if ldc(n, m, list_a[i], list_b[i]) == 1:
		for j in range(t):
			if i != j:
				index_t = 0
				if n >= list_a[i] and m >= list_b[i]:
					if ldc(n - list_a[i], m, list_a[j], list_b[j]) == 1:
						index_t = 1
					if ldc(n, m - list_b[i], list_a[j], list_b[j]) == 1:
						index_t = 1
				if n >= list_b[i] and m >= list_a[i]:
					if ldc(n - list_b[i], m, list_a[j], list_b[j]) == 1:
						index_t = 1
					if ldc(n, m - list_a[i], list_a[j], list_b[j]) == 1:
						index_t = 1
				if index_t == 1:
					s = list_s[i] + list_s[j]
					if max_s < s and s <= n * m:
						max_s = s
print(max_s)


(n, x, y) = map(int, input().split())
Max = 0
lst = []
for i in range(n):
	(a, b) = map(int, input().split())
	lst.append((a, b))
for i in range(n):
	(x1, y1) = lst[i]
	for j in range(i + 1, n):
		(x2, y2) = lst[j]
		if x1 + x2 <= x and max(y1, y2) <= y:
			Max = max(Max, x1 * y1 + x2 * y2)
		elif x1 + y2 <= x and max(y1, x2) <= y:
			Max = max(Max, x1 * y1 + x2 * y2)
		elif y1 + y2 <= x and max(x1, x2) <= y:
			Max = max(Max, x1 * y1 + x2 * y2)
		elif y1 + x2 <= x and max(y2, x1) <= y:
			Max = max(Max, x1 * y1 + x2 * y2)
		else:
			(x1, x2, y1, y2, x, y) = (y1, y2, x1, x2, y, x)
			if x1 + x2 <= x and max(y1, y2) <= y:
				Max = max(Max, x1 * y1 + x2 * y2)
			elif x1 + y2 <= x and max(y1, x2) <= y:
				Max = max(Max, x1 * y1 + x2 * y2)
			elif y1 + y2 <= x and max(x1, x2) <= y:
				Max = max(Max, x1 * y1 + x2 * y2)
			elif y1 + x2 <= x and max(y2, x1) <= y:
				Max = max(Max, x1 * y1 + x2 * y2)
print(Max)


from sys import stdin as fin

def check_place(x1, y1, x2, y2, x, y):
	return x1 + x2 <= x and max(y1, y2) <= y or (max(x1, x2) <= x and y1 + y2 <= y)
(n, a, b) = map(int, fin.readline().split())
maxs = 0
rects = tuple((tuple(map(int, fin.readline().split())) for i in range(n)))
for i in range(n):
	for j in range(n):
		if i != j:
			((x1, y1), (x2, y2)) = (rects[i], rects[j])
			if check_place(x1, y1, x2, y2, a, b) or check_place(x1, y1, y2, x2, a, b) or check_place(y1, x1, x2, y2, a, b) or check_place(y1, x1, y2, x2, a, b):
				maxs = max(maxs, x1 * y1 + x2 * y2)
				pass
print(maxs)


(n, a, b) = [int(i) for i in input().split()]

def fit_check(p, q, r, s):
	if p > a or r > a or q > b or (s > b):
		return 0
	if p + r <= a or q + s <= b:
		return p * q + r * s
	else:
		return 0
ans = 0
seals = [[int(i) for i in input().split()] for j in range(n)]
for i in range(n):
	(p, q) = seals[i]
	for j in range(i + 1, n):
		(r, s) = seals[j]
		ans = max(ans, fit_check(p, q, r, s), fit_check(q, p, r, s), fit_check(p, q, s, r), fit_check(q, p, s, r))
print(ans)


(n, a, b) = map(int, input().split())
mx = 0
x = []
y = []
for i in range(n):
	(r1, r2) = map(int, input().split())
	x.append(r1)
	y.append(r2)
for i in range(n):
	for j in range(i + 1, n):
		val1 = x[i] + x[j]
		val2 = max(y[i], y[j])
		if val1 <= a and val2 <= b:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		elif val1 <= b and val2 <= a:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		val3 = x[i] + y[j]
		val4 = max(x[j], y[i])
		if val3 <= a and val4 <= b:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		elif val3 <= b and val4 <= a:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		val5 = x[j] + y[i]
		val6 = max(x[i], y[j])
		if val5 <= a and val6 <= b:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		elif val5 <= b and val6 <= a:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		val7 = y[i] + y[j]
		val8 = max(x[i], x[j])
		if val7 <= a and val8 <= b:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
		elif val7 <= b and val8 <= a:
			mx = max(mx, x[i] * y[i] + x[j] * y[j])
print(mx)