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.

Difficulty: interview

Starter code:

Solutions:
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)


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)


#! /usr/bin/env python3


def check(x, y, a, b):
    return min(x, y) <= min(a, b) and max(x, y) <= max(a, b)


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

for i in range(n):
    xi, yi = list(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)


n, a, b = list(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)


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 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 = list(map(int, sys.stdin.readline().split()))
    t = []
    for i in range(n):
        x, y = list(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()


n, a, b = list(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):
                    #print(i, j, max(d[i][x1], d[j][x2]), d[i][1 - x1] + d[j][1 - x2])
                    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)


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())
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)

n, a, b = list(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=list(map(int,input().split()))
arr=[]
for x in range(n):
    i,j=list(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)


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
#Rects not squares
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)

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()

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())
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)

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 = list(map(int, input().split()))
x = list(range(n))
y = list(range(n))
for i in range(n):
	x[i], y[i] = list(map(int, input().split()))
ans = 0
for i in range(n):
	for j in range(i + 1, n):
		# 4 ways of rotating
		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 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)


from sys import stdin as fin
# fin = open("ecr26c.in", "r")

def check_place(x1, y1, x2, y2, x, y):
    return (
        # (x1 + x2 <= x and y1 + y2 >= y) or
        (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())
# m = int(fin.readline())
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 = list(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)
   


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)

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]):
            if l[i][0]*l[i][1] + l[j][0]*l[j][1] > maxs:
                maxs = l[i][0]*l[i][1] + l[j][0]*l[j][1]

print(maxs)

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)

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,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)