You are given an infinite 2-d grid with the bottom left cell referenced as (1,1). All the cells contain a value of zero initially. Let's play a game?  

The game consists of N steps wherein each step you are given two integers a and b. The value of each of the cells in the co-ordinate (u, v) satisfying 1 ≤ u ≤ a and 1 ≤ v ≤ b, is increased by 1. After N such steps, if X is the largest number amongst all the cells in the rectangular board, can you print the number of X's in the board?

Input Format 

The first line of input contains a single integer N. N lines follow. 

Each line contains two integers a and b separated by a single space.  

Output Format 

Output a single integer - the number of X's. 

Constraints 

1 ≤ N ≤ 100 

1 ≤ a ≤ 10^{6} 

1 ≤ b ≤ 10^{6}

Sample Input  

3
2 3
3 7
4 1

Sample Output  

2

Explanation

Assume that the following board corresponds to cells (i, j) where 1 ≤ i ≤ 4 and 1 ≤ j ≤ 7.

At the beginning board is in the following state:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 

After the first step we will obtain:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 1 1 0 0 0 0
1 1 1 0 0 0 0 

After the second step we will obtain:

0 0 0 0 0 0 0
1 1 1 1 1 1 1
2 2 2 1 1 1 1
2 2 2 1 1 1 1 

Finally, after the last step we will obtain:

1 0 0 0 0 0 0
2 1 1 1 1 1 1
3 2 2 1 1 1 1
3 2 2 1 1 1 1 

So, the maximum number is 3 and there are exactly two cells which correspond to 3. Hence 2.

Source: hackerrank | Difficulty: EASY
Tags: Geometry


Solutions:
n = int(input())
mx = 0
my = 0
for i in range(n):
	inp = [int(a) for a in input().split()]
	if mx == 0:
		mx = inp[0]
		my = inp[1]
	else:
		mx = min(mx, inp[0])
		my = min(my, inp[1])
print(mx * my)


N = int(input())
row = 1000000
col = 1000000
for i in range(N):
	(x, y) = map(int, input().split())
	row = min(row, x)
	col = min(col, y)
print(row * col)


import sys
r = sys.stdin.readline
text = r()
n = int(text)
maxa = -1
maxb = -1
mina = 10000000
minb = 10000000
data = []
for i in range(n):
	text = r()
	(a, b) = map(int, text.split())
	maxa = max(a, maxa)
	mina = min(a, mina)
	maxb = max(b, maxb)
	minb = min(b, minb)
	data.append((a, b))
print(mina * minb)


k = input()
k = int(k)
(x, y) = ([], [])
for h in range(0, k):
	a = input()
	row = a.split()
	row[0] = int(row[0])
	row[1] = int(row[1])
	x.append(row[0])
	y.append(row[1])
x.sort()
y.sort()
a = int(x[0])
b = int(y[0])
print(a * b)


N = int(input())
a_min = 1000000
b_min = 1000000
for _ in range(N):
	(a, b) = map(int, input().split())
	(a_min, b_min) = (min(a_min, a), min(b_min, b))
print(a_min * b_min)


import sys
N = int(sys.stdin.readline())
(min_a, min_b) = (0, 0)
for _ in range(N):
	(a, b) = list(map(int, sys.stdin.readline().split()))
	min_a = min(min_a, a) if min_a > 0 else a
	min_b = min(min_b, b) if min_b > 0 else b
print(min_a * min_b)


N = int(input())
min_u = min_v = float('inf')
count = 0
for pair in range(N):
	(u, v) = [int(el) for el in input().split()]
	min_u = min(min_u, u)
	min_v = min(min_v, v)
print(min_u * min_v)


n = int(input())
aMin = None
bMin = None
for i in range(n):
	(a, b) = [int(s) for s in input().split()]
	aMin = min(a, aMin) if aMin != None else a
	bMin = min(b, bMin) if bMin != None else b
print(aMin * bMin)


N = int(input())
Amin = 10 ** 6 + 1
Bmin = 10 ** 6 + 1
for i in range(0, N):
	(a, b) = [int(j) for j in input().split()]
	if a < Amin:
		Amin = a
	if b < Bmin:
		Bmin = b
print(Amin * Bmin)


x = y = 10 ** 6
for _ in range(int(input())):
	(x_, y_) = [int(i) for i in input().split()]
	if x_ < x:
		x = x_
	if y_ < y:
		y = y_
print(x * y)


x = []
y = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
print(min(x) * min(y))


N = int(input())
(mina, minb) = (10 ** 6, 10 ** 6)
for _ in range(N):
	(a, b) = (int(_) for _ in input().split())
	if a < mina:
		mina = a
	if b < minb:
		minb = b
print(mina * minb)


import fileinput
x = 9999999
y = 9999999
for line in fileinput.input():
	if not fileinput.isfirstline():
		xx = int(line.split()[0])
		yy = int(line.split()[1])
		if xx < x:
			x = xx
		if yy < y:
			y = yy
print(x * y)


xs = list()
ys = list()
for i in range(int(input())):
	(x, y) = input().split(' ')
	xs += [int(x)]
	ys += [int(y)]
length = min(xs)
width = min(ys)
print(length * width)


N = int(input())
rows = []
columns = []
for i in range(N):
	(row, column) = map(int, input().split())
	rows.append(row)
	columns.append(column)
print(min(columns) * min(rows))


number_moves = int(input())
coordinates = input().split()
min_x = int(coordinates[0])
min_y = int(coordinates[1])
for i in range(1, number_moves):
	coordinates = input().split()
	cur_x = int(coordinates[0])
	cur_y = int(coordinates[1])
	if cur_x < min_x:
		min_x = cur_x
	if cur_y < min_y:
		min_y = cur_y
print(min_x * min_y)


a = 10 ** 6 + 1
b = 10 ** 6 + 1
for n in range(int(input())):
	(na, nb) = map(int, input().split())
	a = min(a, na)
	b = min(b, nb)
print(a * b)


N = int(input())
minX = 10 ** 6
minY = 10 ** 6
for i in range(N):
	(x, y) = map(int, input().split())
	minX = min(minX, x)
	minY = min(minY, y)
print(str(minX * minY))


n = int(input())
x = list()
y = list()
for _ in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
print(min(x) * min(y))


def count_x(rounds):
	min_x = min((e[0] for e in rounds))
	min_y = min((e[1] for e in rounds))
	return min_x * min_y
N = int(input())
rounds = []
for x in range(N):
	rounds.append(tuple((int(a) for a in input().split())))
print(count_x(rounds))


(a, b) = (1000000, 1000000)
for n in range(int(input())):
	(x, y) = map(int, input().split())
	(a, b) = (min(a, x), min(b, y))
print(a * b)


lst = [[int(j) for j in input().split(' ')] for i in range(int(input()))]
print(min((i[0] for i in lst)) * min((i[1] for i in lst)))


N = int(input())
ABs = [input().split(' ') for x in range(N)]
for i in range(len(ABs)):
	ABs[i][0] = int(ABs[i][0])
	ABs[i][1] = int(ABs[i][1])
smallABs = [ABs[0][0], ABs[0][1]]
for i in range(len(ABs)):
	if ABs[i][0] < smallABs[0]:
		smallABs[0] = ABs[i][0]
	if ABs[i][1] < smallABs[1]:
		smallABs[1] = ABs[i][1]
print(smallABs[0] * smallABs[1])


a = []
b = []
for i in range(int(input())):
	inp = [int(a) for a in input().split()]
	a.append(inp[0])
	b.append(inp[1])
print(min(a) * min(b))


def main():
	n = int(input())
	min_x = 10 ** 9
	min_y = 10 ** 9
	for i in range(n):
		(x, y) = [int(z) for z in str(input()).split()]
		if x < min_x:
			min_x = x
		if y < min_y:
			min_y = y
	print(min_x * min_y)
main()


def ans(N):
	lowestX = 10000000
	lowestY = 10000000
	for i in range(N):
		(x, y) = [int(x) for x in input().split()]
		if x < lowestX:
			lowestX = x
		if y < lowestY:
			lowestY = y
	return lowestX * lowestY
print(ans(int(input())))


x = []
y = []
N = int(input())
for i in range(N):
	d = input().split()
	x.append(int(d[0]))
	y.append(int(d[1]))
mx = min(x)
my = min(y)
print(mx * my)


values = [[], []]
for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	values[0].append(a)
	values[1].append(b)
print(min(values[0]) * min(values[1]))


N = int(input())
min_a = 10000000.0
min_b = 10000000.0
for i in range(N):
	(a, b) = (int(x) for x in input().split())
	min_a = min(min_a, a)
	min_b = min(min_b, b)
print(min_a * min_b)


n = int(input())
for i in range(n):
	(c, d) = map(int, input().split())
	if i == 0:
		a = c
		b = d
	if a > c:
		a = c
	if b > d:
		b = d
print(a * b)


minX = float('inf')
minY = float('inf')
for _ in range(int(input())):
	(x, y) = (int(z) for z in input().split(' '))
	minX = min(minX, x)
	minY = min(minY, y)
print(minX * minY)


n = int(input())
(a, b) = map(int, input().split())
for x in range(n - 1):
	(c, d) = map(int, input().split())
	if c < a:
		a = c
	if d < b:
		b = d
print(a * b)


import sys
N = int(sys.stdin.readline())
(min_a, min_b) = (0, 0)
for _ in range(N):
	(a, b) = list(map(int, sys.stdin.readline().split()))
	min_a = min(min_a, a) if min_a > 0 else a
	min_b = min(min_b, b) if min_b > 0 else b
print(min_a * min_b)


n = int(input())
(mnx, mny) = (1000001, 1000001)
for i in range(0, n):
	(x, y) = list(map(int, input().split()))
	if x < mnx:
		mnx = x
	if y < mny:
		mny = y
print(mnx * mny)


n = int(input())
(a, b) = ([], [])
for i in range(n):
	temp = input()
	a.append(int(temp.split()[0]))
	b.append(int(temp.split()[1]))
print(min(a) * min(b))


T = int(input())
mins = [int(s) for s in input().split()]
for _ in range(1, T):
	new = [int(s) for s in input().split()]
	mins = [min(c, d) for (c, d) in zip(mins, new)]
print(mins[0] * mins[1])


a = int(input())
mina = minb = 1000000
for i in range(a):
	c = input().split(' ')
	(c1, c2) = (int(c[0]), int(c[1]))
	if mina > c1:
		mina = c1
	if minb > c2:
		minb = c2
print(mina * minb)


def intersection(p1, p2):
	return (min(p1[0], p2[0]), min(p1[1], p2[1]))
points = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	points.append((a, b))
pi = (1000000, 1000000)
while points:
	pi = intersection(pi, points.pop())
print(pi[0] * pi[1])


import sys
no_of_lines = int(sys.stdin.readline())
min_x = int(0)
min_y = int(0)
for iteration in range(0, no_of_lines):
	line = sys.stdin.readline().split()
	x = int(line[0])
	y = int(line[1])
	if min_x > x or min_x == 0:
		min_x = x
	if min_y > y or min_y == 0:
		min_y = y
print(min_x * min_y)


n = int(input())
amax = 10 ** 6
bmax = 10 ** 6
for _ in range(n):
	(a, b) = map(int, input().split())
	amax = min(a, amax)
	bmax = min(b, bmax)
print(amax * bmax)


N = int(input())
a = b = 1000000
for _ in range(N):
	(a_tmp, b_tmp) = [int(i) for i in input().split()]
	a = min(a, a_tmp)
	b = min(b, b_tmp)
print(a * b)


t = int(input())
ma = mb = 10 ** 6
for _ in range(t):
	(a, b) = map(int, input().split())
	if a < ma:
		ma = a
	if b < mb:
		mb = b
print(ma * mb)


N = int(input())
a = b = 9999999
for _ in range(N):
	(a1, b1) = [int(ns) for ns in str(input()).split()]
	if a1 < a:
		a = a1
	if b1 < b:
		b = b1
print(a * b)


t = int(input())
xs = []
ys = []
for i in range(t):
	(u, v) = list(map(int, input().split(' ')))
	xs.append(u)
	ys.append(v)
print(min(xs) * min(ys))


steps = int(input())
x = []
y = []
for i in range(steps):
	values = input().split()
	values = [int(i) for i in values]
	y.append(values[0])
	x.append(values[1])
print(min(x) * min(y))


import sys
N = int(sys.stdin.readline())
(min_a, min_b) = (0, 0)
for _ in range(N):
	(a, b) = list(map(int, sys.stdin.readline().split()))
	min_a = min(min_a, a) if min_a > 0 else a
	min_b = min(min_b, b) if min_b > 0 else b
print(min_a * min_b)


c = int(input())
x = []
y = []
for n in range(c):
	a = input().split()
	a = [int(x) for x in a]
	x.append(a[0])
	y.append(a[1])
print(min(x) * min(y))


cases = int(input())
width = 1000000
height = 1000000
variables = []
for i in range(cases):
	variables.append(list(map(int, input().split())))
	for i in range(len(variables)):
		if variables[i][0] < height:
			height = variables[i][0]
		if variables[i][1] < width:
			width = variables[i][1]
print(width * height)


def main():
	n = int(input())
	min_a = 10 ** 6
	min_b = 10 ** 6
	for x in range(n):
		(a, b) = map(int, input().split())
		min_a = min(a, min_a)
		min_b = min(b, min_b)
	print(min_a * min_b)
main()


(xa, ya) = ([], [])
for _ in range(int(input())):
	(x, y) = map(int, input().split(' '))
	xa.append(x)
	ya.append(y)
print(min(xa) * min(ya))


cases = int(input())
minn = []
for case in range(cases):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	if case > 0:
		if minn[0] > a:
			minn[0] = a
		if minn[1] > b:
			minn[1] = b
	else:
		minn.append(a)
		minn.append(b)
print(minn[0] * minn[1])


import sys
N = int(sys.stdin.readline())
(min_a, min_b) = (0, 0)
for _ in range(N):
	(a, b) = list(map(int, sys.stdin.readline().split()))
	min_a = min(min_a, a) if min_a > 0 else a
	min_b = min(min_b, b) if min_b > 0 else b
print(min_a * min_b)


n = int(input())
(mn, mx) = (1000010, 1000010)
for cc in range(n):
	(x, y) = map(int, input().split())
	mn = min(mn, x)
	mx = min(mx, y)
print(mx * mn)


minx = 10 ** 6
miny = 10 ** 6
for n in range(int(input())):
	(x, y) = list(map(int, input().split()))
	if x < minx:
		minx = x
	if y < miny:
		miny = y
print(minx * miny)


n = int(input())
minx = miny = None
for i in range(n):
	(x, y) = map(int, input().split())
	if not minx or x < minx:
		minx = x
	if not miny or y < miny:
		miny = y
print(minx * miny)


N = int(input())
r = []
c = []
for i in range(0, N):
	i1 = input()
	i2 = i1.split()
	r.append(int(i2[0]))
	c.append(int(i2[1]))
rmin = min(r)
cmin = min(c)
ans = rmin * cmin
print(ans)


n = int(input())
y = []
x = []
for _ in range(n):
	(a, b) = input().split()
	y.append(a)
	x.append(b)
	y = list(map(int, y))
	x = list(map(int, x))
	mny = min(y)
	mnx = min(x)
print(mny * mnx)


arr = []
nb_cases = int(input())
for i in range(0, nb_cases):
	line = input()
	vals = list(map(int, line.split()))
	arr.append(vals)
ys = [arr[x][0] for x in range(0, len(arr))]
xs = [arr[x][1] for x in range(0, len(arr))]
print(min(ys) * min(xs))


n = int(input())
x = 10 ** 6
y = 10 ** 6
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	x = min(x, a)
	y = min(y, b)
print(x * y)


n = int(input())
x = 1000001
y = 1000001
while n:
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a < x:
		x = a
	if b < y:
		y = b
	n = n - 1
print(x * y)


n = int(input())
(minX, minY) = (1000000, 1000000)
points = []
for i in range(n):
	point = tuple(map(int, input().split(' ')))
	points.append(point)
	if point[1] < minX:
		minX = point[1]
	if point[0] < minY:
		minY = point[0]
print(minX * minY)


n = int(input())
mina = minb = 1000001
for _ in range(n):
	(a, b) = map(int, input().split())
	mina = min(mina, a)
	minb = min(minb, b)
print(mina * minb)


mina = 1000000
minb = 10000000
for n in range(int(input())):
	[a, b] = list(map(int, input().split()))
	if a < mina:
		mina = a
	if b < minb:
		minb = b
print(mina * minb)


num_steps = int(input())
(x_rows, x_cols) = (1000000, 1000000)
for _ in range(num_steps):
	(a, b) = [int(x) for x in input().split()]
	(x_rows, x_cols) = (min(a, x_rows), min(b, x_cols))
print(x_rows * x_cols)


def solve():
	n = int(input())
	x = y = 10000000.0
	for i in range(0, n):
		(a, b) = map(int, input().split())
		if x > a:
			x = a
		if y > b:
			y = b
	print(x * y)
solve()


a = []
b = []
for _ in range(int(input())):
	(c, d) = [int(i) for i in input().split()]
	a.append(c)
	b.append(d)
print(min(a) * min(b))


numPairs = int(input())
mina = float('inf')
minb = float('inf')
for pair in range(numPairs):
	(a, b) = map(int, input().split(' '))
	mina = min(a, mina)
	minb = min(b, minb)
print(mina * minb)


n = int(input())
(mx, my) = (10 ** 6, 10 ** 6)
for i in range(n):
	s = input().split()
	x = int(s[0])
	y = int(s[1])
	mx = min(mx, x)
	my = min(my, y)
print(mx * my)


import sys
a = int(sys.stdin.readline().strip())
li = []
for i in range(a):
	j = [int(j) for j in sys.stdin.readline().strip().split()]
	li.append(j)
m = []
n = []
for (a, b) in li:
	m.append(a)
	n.append(b)
m.sort()
n.sort()
print(m[0] * n[0])


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


N = int(input())
min_a = -1
min_b = -1
for n in range(N):
	(a, b) = map(int, input().split())
	if min_a == -1 or a < min_a:
		min_a = a
	if min_b == -1 or b < min_b:
		min_b = b
print(min_a * min_b)


def rectGame(n):
	num_rects = int(n)
	counter = 0
	while counter < num_rects:
		if counter == 0:
			(max_rows, max_cols) = [int(num) for num in input().split()]
			counter += 1
		else:
			(new_rows, new_cols) = [int(num) for num in input().split()]
			if new_rows < max_rows:
				max_rows = new_rows
			if new_cols < max_cols:
				max_cols = new_cols
			counter += 1
	return max_rows * max_cols
print(rectGame(input()))


N = int(input())
Xmin = 10 ** 6
Ymin = 10 ** 6
for _ in range(N):
	(X, Y) = map(int, input().split())
	if X < Xmin:
		Xmin = X
	if Y < Ymin:
		Ymin = Y
print(Xmin * Ymin)


max1 = 1000000
max2 = 1000000
for i in range(int(input())):
	[num1, num2] = input().split()
	max1 = min(max1, int(num1))
	max2 = min(max2, int(num2))
print(str(max1 * max2))


def countX(arr):
	a = 1000000000
	b = 1000000000
	for i in range(0, len(arr), 2):
		a = min(a, arr[i])
		b = min(b, arr[i + 1])
	print(a * b)
n = int(input())
arr = []
for i in range(n):
	(a, b) = map(int, input().split())
	arr.append(a)
	arr.append(b)
countX(arr)


left = []
right = []
N = int(input())
for i in range(N):
	(x, y) = list(map(int, input().split()))
	left.append(x)
	right.append(y)
print(min(left) * min(right))


num = int(input())
x = [0] * num
y = [0] * num
for i in range(num):
	(x[i], y[i]) = map(int, input().split(' '))
common_xmax = min(x)
common_ymax = min(y)
print(common_xmax * common_ymax)


n = int(input().strip())
mx = my = 10000000
for i in range(n):
	(a, b) = input().strip().split(' ')
	(a, b) = (int(a), int(b))
	if mx > a:
		mx = a
	if my > b:
		my = b
print(mx * my)


t = int(input())
x = []
y = []
for i in range(t):
	a = input().split()
	x.append(int(a[0]))
	y.append(int(a[1]))
print(min(x) * min(y))


from collections import Counter
tups = {}
(x, y) = (10 ** 7, 10 ** 7)
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	if a < x:
		x = a
	if b < y:
		y = b
print(x * y)


import sys
T = int(sys.stdin.readline())
(min_a, min_b) = (0, 0)
for _ in range(T):
	(a, b) = list(map(int, sys.stdin.readline().split()))
	min_a = min(min_a, a) if min_a > 0 else a
	min_b = min(min_b, b) if min_b > 0 else b
print(min_a * min_b)


N = int(input())
mina = 10 ** 6 + 1
minb = 10 ** 6 + 1
for _ in range(N):
	(a, b) = map(int, input().split())
	mina = min(a, mina)
	minb = min(b, minb)
print(mina * minb)


n = int(input().strip())
a = 1000000
b = 1000000
for x in range(0, n):
	arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
	if arr[0] < a:
		a = arr[0]
	if arr[1] < b:
		b = arr[1]
print(a * b)


n = int(input())
(ma, mb) = (10 ** 7, 10 ** 7)
for _ in range(n):
	(a, b) = map(int, input().split())
	ma = min([a, ma])
	mb = min([b, mb])
print(ma * mb)


n = int(input())
a = input().split()
x = int(a[0])
y = int(a[1])
for i in range(1, n):
	a = input().split()
	x = min(x, int(a[0]))
	y = min(y, int(a[1]))
print(x * y)


x = 10000000
y = 10000000
for i in range(int(input())):
	(l, m) = [int(i) for i in input().split()]
	if l < x:
		x = l
	if m < y:
		y = m
print(x * y)


import sys
dat = [line.strip('\n') for line in sys.stdin]
steps = dat[1:]
steps = list(zip(*[step.split() for step in steps]))
X = [int(i) for i in steps[0]]
Y = [int(i) for i in steps[1]]
print(min(X) * min(Y))


n = int(input())
rectangles = {'a': set(), 'b': set()}
for a0 in range(n):
	(a, b) = [int(x) for x in input().split(' ')]
	rectangles['a'].add(a)
	rectangles['b'].add(b)
print(min(rectangles['a']) * min(rectangles['b']))


N = int(input().strip())
(min_x, min_y) = (None, None)
for data in range(N):
	(a, b) = [int(x) for x in input().strip().split(' ')]
	min_x = min(a, min_x) if min_x != None else a
	min_y = min(b, min_y) if min_y != None else b
print(min_x * min_y)


lines = int(input().strip())
coordList = []
for i in range(lines):
	coordList.append(tuple(input().strip().split(' ')))
minX = int(coordList[0][0])
minY = int(coordList[0][1])
for coords in coordList:
	if int(coords[0]) < minX:
		minX = int(coords[0])
	if int(coords[1]) < minY:
		minY = int(coords[1])
print(minX * minY)


x = 10 ** 6
y = 10 ** 6
for _ in range(int(input())):
	(a, b) = [int(i) for i in input().strip().split()]
	x = min(a, x)
	y = min(b, y)
print(x * y)


n = int(input())
am = 1000001
bm = 1000001
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a < am:
		(a, am) = (am, a)
	if b < bm:
		(b, bm) = (bm, b)
print(am * bm)


n = int(input())
sa = -1
sb = -1
for i in range(n):
	a = input().split()
	a = [int(j) for j in a]
	if sa < 0:
		sa = a[0]
		sb = a[1]
	else:
		if a[0] < sa:
			sa = a[0]
		if a[1] < sb:
			sb = a[1]
print(sa * sb)


n = int(input())
xs = []
ys = []
for i in range(n):
	(x, y) = input().strip().split()
	xs.append(int(x))
	ys.append(int(y))
minx = min(xs)
miny = min(ys)
area = minx * miny
print(area)


num = int(input())
array = []
for i in range(num):
	array.append(input().split(' '))
minX = min([int(i[1]) for i in array])
minY = min([int(i[0]) for i in array])
print(minX * minY)


step = int(input())
mintempa = []
mintempb = []
point = []
for i in range(step):
	temp = [int(x) for x in input().split()]
	mintempa.append(temp[0])
	mintempb.append(temp[1])
	point.append(temp)
mina = min(mintempa)
minb = min(mintempb)
res = mina * minb
print(res)


N = int(input())
minU = 10 ** 6 + 7
minV = 10 ** 6 + 7
for _ in range(N):
	coords = list(map(int, input().split(' ')))
	u = coords[0]
	v = coords[1]
	minU = min(u, minU)
	minV = min(v, minV)
print(minU * minV)


min_a = 10 ** 6
min_b = 10 ** 6
for _ in range(int(input())):
	(a, b) = map(int, input().strip().split())
	if a < min_a:
		min_a = a
	if b < min_b:
		min_b = b
print(min_a * min_b)


import sys
n = int(input().strip())
lst = []
min_a = 1000000
min_b = 1000000
for a0 in range(n):
	(a, b) = input().strip().split(' ')
	(a, b) = [int(a), int(b)]
	if a <= min_a:
		min_a = a
	if b <= min_b:
		min_b = b
print(min_a * min_b)