After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parallel to them. Of course, the area of the rectangle must be positive. Wilbur had all four vertices of the planned pool written on a paper, until his friend came along and erased some of the vertices.Now Wilbur is wondering, if the remaining n vertices of the initial rectangle give enough information to restore the area of the planned swimming pool.

The first line of the input contains a single integer n (1 ≤ n ≤ 4) — the number of vertices that were not erased by Wilbur's friend. Each of the following n lines contains two integers xi and yi ( - 1000 ≤ xi, yi ≤ 1000) —the coordinates of the i-th vertex that remains. Vertices are given in an arbitrary order. It's guaranteed that these points are distinct vertices of some rectangle, that has positive area and which sides are parallel to the coordinate axes.

Print the area of the initial rectangle if it could be uniquely determined by the points remaining. Otherwise, print  - 1.

NoteIn the first sample, two opposite corners of the initial rectangle are given, and that gives enough information to say that the rectangle is actually a unit square.In the second sample there is only one vertex left and this is definitely not enough to uniquely define the area.

def area(ps):
    xl = [p[0] for p in ps]
    yl = [p[1] for p in ps]
    lx = max(xl)-min(xl)
    ly = max(yl)-min(yl)
    return lx*ly if lx*ly>0 else -1

ps  = [list(map(int,input().split())) for _ in range(int(input()))]
print(area(ps))

n = int(input())
xpos, ypos = [], []
for x in range(n):
    string = input()
    numbers = string.split()
    xpos.append(int(numbers[0]))
    ypos.append(int(numbers[1]))
a = -1
if n > 1:
    x = xpos[0]
    b = 1
    while xpos[b] == x:
        b += 1
        if b == n:
            break
    if b != n:
        m = abs(x - xpos[b])
        y = ypos[0]
        b = 1
        while ypos[b] == y:
            b += 1
            if b == n:
                break
        if b != n:
            n = abs(y - ypos[b])
            a = m * n
print(a)

# Problem 596A - "Wilbur and Swimming Pool"

def get_area(pts):
	return abs( (pts[0][0]-pts[1][0]) * (pts[0][1]-pts[1][1]) )

n = int(raw_input())
pts, arg = [], []
for i in xrange(0, n):
	r = raw_input()
	pts.append( [int(x) for x in r.split(' ')] )

if n == 1:
	print -1

elif n == 2:
	if pts[0][0] == pts[1][0] or pts[0][1] == pts[1][1]:
		print -1
	else:
		print get_area(pts)

elif n == 3:
	if pts[0][0] == pts[1][0] or pts[0][1] == pts[1][1]:
		if pts[0][0] == pts[2][0] or pts[0][1] == pts[2][1]:
			arg.extend( [pts[1], pts[2]] )
		else:
			arg.extend( [pts[0], pts[2]] )
	else:
		arg.extend( [pts[0], pts[1]] )

	print get_area(arg)

else:
	for i in xrange(1, n):
		if pts[0][0] != pts[i][0] and pts[0][1] != pts[i][1]:
			arg.extend( [pts[0], pts[i]] )
			break

	print get_area(arg)

exit(0)

a=int(raw_input())
arr=[]
for i in xrange (a):
    arr+=[map(int,raw_input().split())]
if a == 1:
    print -1
if a == 2:
    x=arr[0][0]-arr[1][0]
    y=arr[0][1]-arr[1][1]
    if abs(x*y) == 0:
        print -1
    else:
        print abs(x*y)
if a == 3 or a == 4:
    minx = 1000
    maxx = -1000
    miny = 1000
    maxy = -1000
    for i in arr:
        if i[0] < minx:
            minx = i[0]
        if i[0] > maxx:
            maxx = i[0]
        if i[1] < miny:
            miny = i[1]
        if i[1] > maxy:
            maxy = i[1]
    x = maxx-minx
    y = maxy-miny
    if abs(x*y) == 0:
        print -1
    else:
        print abs(x*y)

n = int(raw_input())
points = [tuple(map(int,raw_input().split(" "))) for _ in xrange(n)]
def find_corners(points):
    for i in range(len(points)-1):
        for j in range(i+1, len(points)):
            if points[i][0] != points[j][0] and points[i][1] != points[j][1]:
                return (i,j)
    return (None, None)

a,b = find_corners(points)
if a is None:
    print "-1"
else:
    print abs(points[a][0]-points[b][0]) * abs(points[a][1]-points[b][1])

def area():
    for i in range(len(val)):
        for j in range(1, len(val)):
            tmp = abs(val[i][0]-val[j][0]) * abs(val[i][1]-val[j][1])
            if tmp != 0:
                return tmp
    return -1

n = int(input())
val = [list(map(int, input().split())) for _ in range(n)]
print(area())

#!/usr/bin/python3

n = int(input())
arr = [tuple(map(int, input().split())) for i in range(n)]
arr.sort()

mna = 1791
mxa = -1791
mnb = 1791
mxb = -1791
for i in range(n):
    mna = min(mna, arr[i][0])
    mnb = min(mnb, arr[i][1])
    mxa = max(mxa, arr[i][0])
    mxb = max(mxb, arr[i][1])

if mna == mxa or mnb == mxb:
    print(-1)
else:
    print((mxa - mna) * (mxb - mnb))

n=int(input())
l=[]
if n==0:
    print("-1")
else:
    for i in range(n):
        x,y=map(int,input().split())
        l+=[[x,y]]
if n==1 :
    print("-1")
else:
    c=0
    for i in range(n-1):
        j=i+1
        while j<n:
            if l[j][0]!=l[i][0] and l[j][1]!=l[i][1]:
                result=(l[i][0]-l[j][0])*(l[i][1]-l[j][1])
                c=1
                break
            j+=1
        if c:
            if result<0:
                print(-result)
            else:
                print(result)
            break
    if not c:
        print('-1')

# your code goes here
n = input()
px = set()
py = set()
for z in xrange(n):
    x,y = [int(r) for r in raw_input().split()]
    px.add(x)
    py.add(y)

if len(px) == len(py) == 2:
    xdiff = max(px)-min(px)
    ydiff = max(py)-min(py)
    print xdiff*ydiff
else:
    print -1

import sys
from sys import stdin,stdout
import math
from math import sqrt

n = int(input())
coords = []
for i in range(n):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    coords.append([x,y])

if n <= 1:
    print(-1)

if n == 2:
    a = coords[0]
    b = coords[1]
    if (a[0] == b[0]) or (a[1] == b[1]):
        print(-1)
    else:
        print(abs(a[0]-b[0])*abs(a[1]-b[1]))

if n >= 3:
    a = coords[0]
    b = coords[1]
    c = coords[2]

    ab = sqrt( (a[0]-b[0])**2 + (a[1]-b[1])**2 )
    ac = sqrt( (a[0]-c[0])**2 + (a[1]-c[1])**2 )
    bc = sqrt( (c[0]-b[0])**2 + (c[1]-b[1])**2 )

    ll = [ab,ac,bc]
    srted = sorted(ll)
    print(int(srted[0]*srted[1]))

n=input()
x=[]
y=[]
for i in range(0,n):
    a,b=(int(i) for i in raw_input().split())
    x.append(a)
    y.append(b)
    f=0
for i in range(0,n):
    for j in range(i+1,n):
        if(x[i]!=x[j] and y[i]!=y[j]):
            print abs(x[i]-x[j])*abs(y[i]-y[j])
            f=1
            break
    if(f==1):
        break
if(f==0):
    print -1

n = int(input())
if (n == 1):
    print(-1)
elif (n == 2):
    x1, y1 = map(int, input().split())
    x2, y2 = map(int, input().split())
    if (x1 == x2) or (y1 == y2):
        print(-1)
    else:
        print(abs(x2 - x1) * abs(y2 - y1))
else:
    x1, y1 = map(int, input().split())
    x2, y2 = map(int, input().split())
    x3, y3 = map(int, input().split())
    if (x1 == x2) or (y1 == y2):
        if (x1 == x3) or (y1 == y3):
            print(abs(x3 - x2) * abs(y3 - y2))
        else:
            print(abs(x3 - x1) * abs(y3 - y1))
    else:
        print(abs(x2 - x1) * abs(y2 - y1))

#----Kuzlyaev-Nikita-Codeforces-----
#------------08.04.2020-------------

import math
alph="abcdefghijklmnopqrstuvwxyz"

#-----------------------------------

n=int(input())
a=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append([x,y])
if n==1:print(-1)
else:
    S=0
    for i in range(n-1):
        for j in range(i+1,n):
            x1,y1,x2,y2=a[i][0],a[i][1],a[j][0],a[j][1]
            if x1!=x2 and y1!=y2:
                S=abs(x1-x2)*abs(y1-y2)

    if S!=0:print(S)
    else:
        print(-1)

n = int(raw_input())
a = [map(int, raw_input().split()) for _ in xrange(n)]
t = (max(x[0] for x in a) - min(x[0] for x in a)) * (max(x[1] for x in a) - min(x[1] for x in a))
if t == 0:
    print -1
else:
    print t

n = int(input())
points = [[int(x) for x in input().split()] for _ in range(n)]
if n <= 1:
	print(-1)
	exit()
dx = [1e9, -1e9]
dy = [1e9, -1e9]
for x, y in points:
	dx[0] = min(dx[0], x)
	dx[1] = max(dx[1], x)
	dy[0] = min(dy[0], y)
	dy[1] = max(dy[1], y)
area = (dx[1] - dx[0]) * (dy[1] - dy[0])
if area:
	print(area)
else:
	print(-1)

__author__ = 'MoonBall'

li = [list(map(int,input().split())) for i in range(int(input()))]
sx,sy = set(i[0] for i in li),set(i[1] for i in li)
print ((max(sx)-min(sx))*(max(sy)-min(sy)) or -1)

def basseyn(lst1, lst2):
    result = -1
    for i in range(len(lst1)):
        for j in range(i, len(lst1)):
            if lst1[i] != lst1[j] and lst2[i] != lst2[j]:
                result = abs(lst1[i] - lst1[j]) * abs(lst2[i] - lst2[j])
    return result

n = int(input())
X = list()
Y = list()
for i in range(n):
    x, y = [int(i) for i in input().split()]
    X.append(x)
    Y.append(y)
print(basseyn(X, Y))

n=int(input())
if n<2:
    print(-1)
else:
    x=set()
    y=set()
    for i in range(n):
        a=tuple(map(int,input().split()))
        x.add(a[0])
        y.add(a[1])
    if len(y)>1 and len(x)>1:
        print((max(y)-min(y))*(max(x)-min(x)))
    else:
        print(-1)

v=zip(*[map(int,raw_input().split()) for _ in range(input())])
print (max(v[0])-min(v[0]))*(max(v[1])-min(v[1])) or -1

from fractions import gcd
t = input()
if(t==1):
	print -1
else:
	if(t==2):
		x1,y1 = map(int, raw_input().split())
		x2,y2 = map(int, raw_input().split())
		if(x1!=x2 and y1!=y2):
			print abs(x2-x1)*abs(y2-y1)
		else:
			print -1
	if(t==3):
		x1,y1 = map(int, raw_input().split())
		x2,y2 = map(int, raw_input().split())
		x3,y3 = map(int, raw_input().split())
		print max(abs(x2-x1)*abs(y2-y1),abs(x3-x1)*abs(y3-y1),abs(x3-x2)*abs(y3-y2))
	if(t==4):
		x1,y1 = map(int, raw_input().split())
		x2,y2 = map(int, raw_input().split())
		x3,y3 = map(int, raw_input().split())
		x4,y4 = map(int, raw_input().split())
		print max(abs(x2-x1)*abs(y2-y1),abs(x3-x1)*abs(y3-y1),abs(x3-x2)*abs(y3-y2))

def main():
    l = []
    for _ in range(int(input())):
        x1, y1 = map(int, input().split())
        for x2, y2 in l:
            s = (x1 - x2) * (y1 - y2)
            if s:
                print(abs(s))
                return
        l.append((x1, y1))
    print(-1)

if __name__ == '__main__':
    main()

def area(ps):
    xl = [p[0] for p in ps]
    yl = [p[1] for p in ps]
    lx = max(xl)-min(xl)
    ly = max(yl)-min(yl)
    return lx*ly if lx*ly>0 else -1

ps  = [list(map(int,input().split())) for _ in range(int(input()))]
print(area(ps))

n=int(input())
x=n*[0]
y=n*[0]
for i in range(n):
    x[i],y[i]=[int(i) for i in input().split()]
if n==1:
    print(-1)
else:
    if n==2:
        if x[0]==x[1] or y[0]==y[1]:
            print(-1)
        else:
            print(abs((x[0]-x[1])*(y[0]-y[1])))
    elif n==3 or n==4:
        x.sort()
        y.sort()
        print(abs((max(x)-min(x))*(max(y)-min(y))))

n = int(input())
if n == 1:
    print(-1)
    exit()
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())
if n == 2:
    if x[0] == x[1] or y[0] == y[1]:
        print(-1)
    else:
        print(abs(x[0]-x[1]) * abs(y[0]-y[1]))
else:
    for i in range(n):
        for j in range(n):
            if x[i] != x[j] and y[i] != y[j]:
                print(abs(x[i]-x[j]) * abs(y[i]-y[j]))
                exit()

__author__ = 'MoonBall'

import sys
# sys.stdin = open('A.in', 'r')

li = [list(map(int,input().split())) for i in range(int(input()))]
sx,sy = set(i[0] for i in li),set(i[1] for i in li)
print ((max(sx)-min(sx))*(max(sy)-min(sy)) or -1)

import sys

def check_point(c, d):
    if c[0] != d[0] and c[1] != d[1]:
        return True
    else:
        return False

def square(c, d):
    return abs(c[0] - d[0]) * abs(c[1] - d[1])

n = int(input())
a = []
q = 0
h = 0
for x in range(n):
    a.append(list(map(int, input().split())))
if n == 2:
    if check_point(a[0], a[1]):
        print(square(a[0], a[1]))
    else:
        print(-1)
elif n == 3:
    if check_point(a[0], a[1]):
        print(square(a[0], a[1]))
    elif check_point(a[0], a[2]):
        print(square(a[0], a[2]))
    elif check_point(a[2], a[1]):
        print(square(a[1], a[2]))
    else:
        print(-1)
elif n == 4:
    if check_point(a[0], a[1]) and check_point(a[2], a[3]):
        print(square(a[0], a[1]))
    elif check_point(a[1], a[2]) and check_point(a[0], a[3]):
        print(square(a[1], a[2]))
    elif check_point(a[0], a[2]) and check_point(a[1], a[3]):
        print(square(a[0], a[2]))

else:
    print(-1)

v=zip(*[map(int,raw_input().split()) for _ in range(input())])
a=(max(v[0])-min(v[0]))*(max(v[1])-min(v[1]))
print a or -1

import math
def check(i,j):
    if int (i[0]) == int(j[0]): return False
    if int (i[1]) == int(j[1]): return False
    return True
n = int(raw_input())
a = []
for i in range(n):
    a.append(raw_input().split())
if n <= 1: print -1
if n == 2:
    if check(a[0],a[1]):
        print int(math.fabs(int(a[0][0])-int(a[1][0])) *math.fabs(int(a[0][1])-int(a[1][1])))
    else: print -1
else:
    t = False
    for i in range(n-1):
        if t == True: break
        for j in range(i,n):
            if check(a[i],a[j]):
                print int(math.fabs(int(a[i][0])-int(a[j][0])) *math.fabs(int(a[i][1])-int(a[j][1])))
                t = True
                break

n = int(input())
maxX = maxY = -1001
minX = minY = 1001
for i in range(n):
    x, y = map(int, input().split())
    maxX = max(maxX, x)
    minX = min(minX, x)
    maxY = max(maxY, y)
    minY = min(minY, y)
s = (maxX - minX) * (maxY - minY)
print(s if s > 0 else -1)

n = int(input())
read = lambda : map(int,input().split())
x1,y1 = read()
x2=x1
y2=y1
for _ in range(n-1):
    x,y = read()
    x1 = min(x1,x)
    x2 = max(x2,x)
    y1 = min(y1,y)
    y2 = max(y2,y)
if x1==x2 or y1==y2:
    print(-1)
else:
    print((x2-x1)*(y2-y1))

from sys import stdin

ax = []
ay = []
n = int(stdin.readline())

for i in range(0, n):
    x, y = map(int, stdin.readline().split())
    ax.append(x)
    ay.append(y)

if n == 1:
    print(-1)
elif n == 2:
    if ax[0] != ax[1] and ay[0] != ay[1]:
        print(abs(ax[0] - ax[1]) * abs(ay[0] - ay[1]))
    else:
        print(-1)
else:
    print((max(ax) - min(ax)) * (max(ay) - min(ay)))

import sys
# input_file = open("in.txt")
input_file = sys.stdin

input_file.readline()
x_coords = set()
y_coords = set()
for line in input_file.readlines():
  x,y = map(int,line.rstrip().split())
  x_coords.add(x)
  y_coords.add(y)
if len(x_coords) == 2 and len(y_coords)==2:
  print(abs(x_coords.pop()-x_coords.pop()) * abs(y_coords.pop()-y_coords.pop()))

else:
  print(-1)

n=int(input())
a=[]
for i in range(n):
    b=list(map(int,input().split()))
    a.append(b)
for i in range(n):
    for j in range(n):
        if(a[i][0]!=a[j][0] and a[i][1]!=a[j][1]):
            print(abs(a[i][0]-a[j][0])*abs(a[i][1]-a[j][1]))
            exit()
print('-1')

n=input()
a=set()
b=set()
for _ in xrange(n):
    t=map(int,raw_input().split())
    a.add(t[0])
    b.add(t[1])
ans=-1
if len(a)==2 and len(b)==2:
    a=list(a)
    b=list(b)
    a.sort()
    b.sort()
    ans=(b[1]-b[0])*(a[1]-a[0])
print ans

# Description of the problem can be found at http://codeforces.com/problemset/problem/596/A

d_y = {}
d_x = {}

l_c = list()
l_c = list()

n = int(input())

for _ in range(n):
    x, y = map(int, input().split())
    d_x[x] = 1
    d_y[y] = 1
    l_c.append([x, y])

if len(d_x) + len(d_y) < 4:
    print(-1)
    quit()

t_x = 0
t_y = 0
i = 1
for k_x in d_x:
    t_x += (-1 if i == 0 else 1) * k_x
    i = 0
i = 1
for k_y in d_y:
    t_y += (-1 if i == 0 else 1) * k_y
    i = 0

print(abs(t_x) * abs(t_y))

# -*- coding: utf-8 -*-
n = int(raw_input())
x, y = set(), set()

if n == 1:
    print('-1')
else:
    for i in xrange(n):
        _x, _y = map(int, raw_input().split(' '))
        x.add(_x)
        y.add(_y)
    if len(x) > 1 and len(y) > 1:
        x = list(set(x))
        y = list(set(y))
        print(abs(x[0]-x[1])*abs(y[0]-y[1]))
    else:
        print('-1')

import math as mt
import sys,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
def dist(x,y,c,d):
    return mt.sqrt((x-c)**2+(y-d)**2)
def circle(x1, y1, x2,y2, r1, r2):

    distSq = (((x1 - x2)* (x1 - x2))+ ((y1 - y2)* (y1 - y2)))**(.5)

    if (distSq + r2 <= r1):
        return True
    else:
        return False

n=I()
if(n==1):
    c,d=M()
    print(-1)
elif(n==2):
    a,b=M()
    c,d=M()
    x=abs(a-c)*abs(b-d)
    if(x):
        print(x)
    else:
        print(-1)
else:
    sx=set([])
    sy=set([])
    for i in range(n):
        a,b=M()
        sx.add(a)
        sy.add(b)
    sx=list(sx)
    sy=list(sy)
    print(abs(sx[0]-sx[1])*abs(sy[0]-sy[1]))

N = int(raw_input())

if N == 1:
	print -1
	exit()
A = set()
B = set()
for _ in range(N):
	tmp = map(int, raw_input().split())
	A.add(tmp[0])
	B.add(tmp[1])

A = list(A)
B = list(B)

if len(A) == 2 and len(B) == 2:
	print abs(A[1] - A[0]) * abs(B[1] - B[0])
else:
	print -1

import math

def get_n():
    return int(input())

def get_int_vector():
    return [int(x) for x in input().split()]

def list2string(list):
    result = []
    for i in list:
        result.append(str(i))
    return ':'.join(result)

def string2vector(string):
    return [int(x) for x in string.split(':')]

n = get_n()

points = []
for _ in range(n):
    points.append(get_int_vector())

points.sort(key=lambda x: x[1])
points.sort(key=lambda x: x[0])

if n == 1:
    print(-1)
    exit(0)
if n == 2 and (points[0][0] == points[1][0] or points[0][1] == points[1][1]):
    print(-1)
    exit(0)

if n == 3:
    a, b = 0, 0
    if points[0][0] != points[1][0]:
        a = abs(points[1][0]-points[0][0])
    else:
        a = abs(points[2][0]-points[0][0])
    if points[0][1] != points[1][1]:
        b = abs(points[1][1]-points[0][1])
    else:
        b = abs(points[2][1]-points[0][1])
    print(a*b)
elif n == 2:
    print(abs(points[0][0]-points[1][0])*abs(points[0][1]-points[1][1]))
else:
    print(abs(points[0][1]-points[1][1])*abs(points[0][0]-points[3][0]))

n = int(input())
res = -1
if n > 1:
    if n > 2:
        a = list(input().split(' '))
        x1, y1 = int(a[0]), int(a[1])
        a = list(input().split(' '))
        x2, y2 = int(a[0]), int(a[1])
        a = list(input().split(' '))
        x3, y3 = int(a[0]), int(a[1])
        if n == 4:
            a = list(input().split(' '))
            x4, y4 = int(a[0]), int(a[1])
        if x1 != x2 and y1 != y2:
            res = abs(x1 - x2) * abs(y1 - y2)
        elif x1 != x3 and y1 != y3:
            res = abs(x1 - x3) * abs(y1 - y3)
        elif x2 != x3 and y2 != y3:
            res = abs(x2 - x3) * abs(y2 - y3)
        elif n == 4:
            res = abs(x1 - x4) * abs(y1 - y4)
    else:
        a = list(input().split(' '))
        x1, y1 = int(a[0]), int(a[1])
        a = list(input().split(' '))
        x2, y2 = int(a[0]), int(a[1])
        if x1 != x2 and y1 != y2:
            res = abs(x1 - x2) * abs(y1 - y2)
print(res)

import sys
n = int(input())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
if n <= 1:
    print(-1)
    sys.exit()
for i in range(n):
    for o in range(i+1, n):
        if a[i][0] != a[o][0] and a[i][1] != a[o][1]:
            print(abs(a[i][0] - a[o][0]) * abs(a[i][1] - a[o][1]))
            sys.exit()
print(-1)

x=int(input())
s=[]
Ox=[]
Oy=[]
l=1
for i in range (x):
    s.append(raw_input())
    s1=s[i].split()
    Ox.append(s1[0])
    Oy.append(s1[1])
if(x==1):
    print '-1'
elif(x>1):
    for j in range (x):
        for i in range (x):
            if(int(Ox[j])!=int(Ox[i]) and int(Oy[j])!=int(Oy[i]) and l==1):
                print abs(int(Ox[i])-int(Ox[j]))*abs(int(Oy[i])-int(Oy[j]))
                l=0
    if(l==1):
        print '-1'

def solve(n, verts):
	if n == 1:
		return -1
	if n == 2:
		if verts[0][0] == verts[1][0] or verts[0][1] == verts[1][1]:
			return -1
		else:
			return abs(verts[0][0] - verts[1][0]) * abs(verts[0][1] - verts[1][1])
	if n == 3 or n == 4:
		greatestX = -100000
		greatestY = -100000
		lowestX = 100000
		lowestY = 100000
		for i in verts:
			if i[0] < lowestX:
				lowestX = i[0]
			if i[1] < lowestY:
				lowestY = i[1]
			if i[0] > greatestX:
				greatestX = i[0]
			if i[1] > greatestY:
				greatestY = i[1]
		return abs(greatestX - lowestX) * abs(greatestY - lowestY)

n = int(raw_input())
verts = [map(int, raw_input().split()) for i in range(n)]
print solve(n, verts)

#!/usr/bin/env python3
# 596A_pool.py - Codeforces.com/problemset/problem/596/A by Sergey 2015

import unittest
import sys

###############################################################################
# Pool Class (Main Program)
###############################################################################

class Pool:
    """ Pool representation """

    def __init__(self, test_inputs=None):
        """ Default constructor """

        it = iter(test_inputs.split("\n")) if test_inputs else None

        def uinput():
            return next(it) if it else sys.stdin.readline().rstrip()

        # Reading single elements
        [self.n] = map(int, uinput().split())

        # Reading multiple number of lines of the same number of elements each
        l, s = self.n, 2
        inp = (" ".join(uinput() for i in range(l))).split()
        self.numm = [[int(inp[i]) for i in range(j, l*s, s)] for j in range(s)]
        self.numa, self.numb = self.numm

    def calculate(self):
        """ Main calcualtion function of the class """

        result = 0
        m = min(3, len(self.numa))

        for i in range(m):
            for j in range(i+1, m):
                result += abs(
                    (self.numa[i] - self.numa[j]) *
                    (self.numb[i] - self.numb[j]))
        if result == 0:
            result = -1

        return str(result)

###############################################################################
# Unit Tests
###############################################################################

class unitTests(unittest.TestCase):

    def test_single_test(self):
        """ Pool class testing """

        # Constructor test
        test = "2\n0 0\n1 1"
        d = Pool(test)
        self.assertEqual(d.n, 2)
        self.assertEqual(d.numa, [0, 1])
        self.assertEqual(d.numb, [0, 1])

        # Sample test
        self.assertEqual(Pool(test).calculate(), "1")

        # Sample test
        test = "1\n1 1"
        self.assertEqual(Pool(test).calculate(), "-1")

        # Sample test
        test = "4\n2 2\n3 3\n2 3\n3 2"
        self.assertEqual(Pool(test).calculate(), "1")

        # My tests
        test = "2\n100 100\n0 0"
        self.assertEqual(Pool(test).calculate(), "10000")

        # Time limit test
        # self.time_limit_test(5000)

    def time_limit_test(self, nmax):
        """ Timelimit testing """
        import random
        import timeit

        # Random inputs
        test = str(nmax) + " " + str(nmax) + "\n"
        numnums = [str(i) + " " + str(i+1) for i in range(nmax)]
        test += "\n".join(numnums) + "\n"
        nums = [random.randint(1, 10000) for i in range(nmax)]
        test += " ".join(map(str, nums)) + "\n"

        # Run the test
        start = timeit.default_timer()
        d = Pool(test)
        calc = timeit.default_timer()
        d.calculate()
        stop = timeit.default_timer()
        print("\nTimelimit Test: " +
              "{0:.3f}s (init {1:.3f}s calc {2:.3f}s)".
              format(stop-start, calc-start, stop-calc))

if __name__ == "__main__":

    # Avoiding recursion limitaions
    sys.setrecursionlimit(100000)

    if sys.argv[-1] == "-ut":
        unittest.main(argv=[" "])

    # Print the result string
    sys.stdout.write(Pool().calculate())

def judgeTwoPoints( pa , pb ):
    if pa[0] != pb[0] and pa[1] != pb[1]:
        #print( "ok!" , pa , pb , abs( pa[0] - pb[0] ) * abs( pa[1] - pb[1] ) )
        return abs( pa[0] - pb[0] ) * abs( pa[1] - pb[1] )
    else:
        return -1

def solve( pts , n ):
    if n == 1:
        return -1

    pts.sort()
    if n == 2:
        return judgeTwoPoints( pts[0] , pts[1] )
    if n == 3:
        resa = judgeTwoPoints( pts[0] , pts[1] )
        resb = judgeTwoPoints( pts[1] , pts[2] )
        resc = judgeTwoPoints( pts[0] , pts[2] )
        return max( resa , resb , resc )

    return judgeTwoPoints( pts[1] , pts[2] )

if __name__ == "__main__":
    n = int( input() )
    pts = []
    for _ in range(n):
        pts.append( tuple([int(x) for x in input().split()]) )

    #print( pts )
    print( solve( pts , n ) )

import sys
def i(): return sys.stdin.readline().strip()

n=int(i())
x,y=[],[]
for e in xrange(n):
    _=i().split(" ")
    info=(int(_[0]),int(_[1]))
    if len(x)==0:
        x.append(info[0])
    else:
        if info[0] not in x:
            x.append(info[0])
    if len(y)==0:
        y.append(info[1])
    else:
        if info[1] not in y:
            y.append(info[1])

#print x,y
if len(x)==2 and len(y)==2:
    print abs(x[0]-x[1])*abs(y[0]-y[1])
else:
    print -1

def solve(x, y):
    if len(x) < 2:
        return -1
    elif len(x) == 2:
        if x[0] == x[1] or y[0] == y[1]:
            return - 1
        else:
            return abs(x[0] - x[1]) * abs(y[0] - y[1])
    else:
        for i in range(len(x)):
            for j in range(len(x)):
                if x[i] != x[j] and y[i] != y[j]:
                    return abs(x[i] - x[j]) * abs(y[i] - y[j])
    return - 1

def main():
    cases = raw_input()
    x = []
    y = []
    for _ in range(int(cases)):
        line = raw_input()
        line_s = line.split()
        x.append(int(line_s[0]))
        y.append(int(line_s[1]))

    print solve(x, y)

if __name__ == '__main__':
    main()

n = int(input())
min_x, min_y, max_x, max_y = 1001, 1001, -1001, -1001
for _ in range(n):
    x, y = map(int, input().split())
    min_x = min(min_x, x)
    max_x = max(max_x, x)
    min_y = min(min_y, y)
    max_y = max(max_y, y)
if min_x != max_x and min_y != max_y:
    print((max_x - min_x) * (max_y - min_y))
else:
    print(-1)

import sys

def solve(points):
    if len(points) < 2:
        return -1

    if len(points) == 2:
        dx = abs(points[0][0] - points[1][0])
        dy = abs(points[0][1] - points[1][1])
        if dx == 0 or dy == 0:
            return -1
        else:
            return dx*dy
    else:
        dx = abs(points[0][0] - points[1][0])
        if dx == 0:
            dx = abs(points[0][0] - points[2][0])

        dy = abs(points[0][1] - points[1][1])
        if dy == 0:
            dy = abs(points[0][1] - points[2][1])

        return dx*dy

if __name__=='__main__':
    lines = sys.stdin.readlines()

    n = int(lines[0].strip().split()[0])

    points = []

    for i in range(n):
        x, y = [int(v) for v in lines[i+1].strip().split()]
        points.append([x, y])

    print solve(points)

__author__ = 'suvasish'

def make_positive(num):
    return num * -1

def chek_positive(num):
    if num >= 1:
        return num
    else:
        return make_positive(num)

vertices = []
x_axis = []
y_axis = []

n = int(input())
if n == 1:
    z = input()
    print(-1)
    exit(0)

for r in range(0, n):
    vertices.append(list(map(int, input().split(' '))))
    for itm in vertices:
            x_val = itm[0]
            if x_val not in x_axis:
                x_axis.append(x_val)
            y_val = itm[1]
            if y_val not in y_axis:
                y_axis.append(y_val)
# print('X:', x_axis, '---', 'Y:', y_axis)
if len(x_axis) == 1 or len(y_axis) == 1:
    print(-1)
    exit(0)
x_axis.sort()
y_axis.sort()
# print('X:', x_axis, '---', 'Y:', y_axis)
length = x_axis[-1] - x_axis[0]
width = y_axis[-1] - y_axis[0]
# print('length: ', length)
# print('width: ', width)

print(chek_positive(length*width))

n = int(raw_input())
arr = []
xs = set()
ys = set()
for i in range(n):
    x,y = map(int, raw_input().split())
    xs.add(x)
    ys.add(y)

if len(xs) >= 2 and len(ys) >= 2:
    print (max(xs) - min(xs)) * (max(ys) - min(ys))
else:
    print -1

# print("Input n")
n = int(input())

a = [[0 for i in range(2)] for j in range(n)]

for i in range(n):
    # print("Input the next pair of vertices")
    x,y = [int(t) for t in input().split()]
    a[i][0] = x
    a[i][1] = y

if n == 1:
    print(-1)
elif n == 2:   # Can do it if they form a diagonal
    if a[0][0] == a[1][0] or a[0][1] == a[1][1]:
        print(-1)
    else:
        print(abs(a[0][0] - a[1][0]) * abs(a[0][1] - a[1][1]))
else:   #  n == 3 or n == 4
    # Find the two that are on a diag--then same logic as before
    # Just compute three and take the positive one
    one = abs(a[0][0] - a[1][0]) * abs(a[0][1] - a[1][1])
    two = abs(a[0][0] - a[2][0]) * abs(a[0][1] - a[2][1])
    three = abs(a[1][0] - a[2][0]) * abs(a[1][1] - a[2][1])
    print(max(one, two, three))

l, r = [], 0
for _ in range(int(input())):
    a, b = map(int, input().split())
    for c, d in l:
        r = max(r, abs((a - c) * (b - d)))
    l.append((a, b))
print(r if r else -1)

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

from collections import namedtuple

def get_area(vertices):
    num_vertices = len(vertices)
    Vertex = namedtuple("Vertex", ["x", "y"])
    vertices = [Vertex(*vertex) for vertex in vertices]
    if num_vertices <= 1:
        return -1

    # sort on x axis
    vertices = sorted(vertices)

    x_diff = 0
    y_diff = 0
    previous = vertices[0]
    for i in range(1, num_vertices):
        if x_diff and y_diff:
            return abs(y_diff * x_diff)
        else:
            if not x_diff and vertices[i].x != previous.x:
                x_diff = vertices[i].x - previous.x
            if not y_diff and vertices[i].y != previous.y:
                y_diff = vertices[i].y - previous.y
            previous = vertices[i]

    return abs(x_diff * y_diff) or -1

def get_raw_input():
    num_vertices = int(raw_input())
    vertices = []
    for i in range(num_vertices):
        vertex = raw_input().split(" ")
        vertices.append((int(vertex[0]), int(vertex[1])))
    return vertices

if __name__ == "__main__":
    vertices = get_raw_input()
    print get_area(vertices)

n=int(input())
to=[]
if n==1:
    print(-1)
elif n==2:
    for x in range(2):
        l,k=input().split()
        to.append(int(l))
        to.append(int(k))
    if to[0]!=to[2] and to[1]!=to[3]:
        print(abs(to[0]-to[2])*abs(to[1]-to[3]))
    else:
        print(-1)
elif n==3:
    for x in range(3):
        l,k=input().split()
        to.append(int(l))
        to.append(int(k))
    if to[0]!=to[2] and to[1]!=to[3]:
        print(abs(to[0]-to[2])*abs(to[1]-to[3]))
    elif to[0]!=to[4] and to[1]!=to[5]:
        print(abs(to[0]-to[4])*abs(to[1]-to[5]))
    else:
        print(abs(to[2]-to[4])*abs(to[3]-to[5]))
else:
    for x in range(4):
        l,k=input().split()
        to.append(int(l))
        to.append(int(k))
    if to[0]!=to[2] and to[1]!=to[3]:
        print(abs(to[0]-to[2])*abs(to[1]-to[3]))
    elif to[0]!=to[4] and to[1]!=to[5]:
        print(abs(to[0]-to[4])*abs(to[1]-to[5]))
    else:
        print(abs(to[0]-to[6])*abs(to[1]-to[7]))

import sys

vert = input()
if vert>4 or vert<1:
   print -1
   sys.exit(0)

pt = {}
for i in range(vert):
   input = raw_input()
   points = input.split(" ")
   points = map(int, points)
   if points[0]<-1000 or points[1]>1000:
      print -1
      sys.exit(0)
   pt[i] = points

if vert == 1:
   print -1
   sys.exit(0)
elif vert == 2:
   point1 = pt[0]
   point2 = pt[1]
   if point1[0] != point2[0] and point1[1] != point2[1]:
      pass
   else:
      print -1
      sys.exit(0)
   area = abs(point1[0] - point2[0])*abs(point1[1] - point2[1])
   print area
   sys.exit(0)
elif vert == 3:
   point1 = pt[0]
   point2 = pt[1]
   point3 = pt[2]
   if point1[0] != point2[0] and point1[1] != point2[1]:
      area = abs(point1[0] - point2[0])*abs(point1[1] - point2[1])
      print area
      sys.exit(0)
   elif point1[0] != point3[0] and point1[1] != point3[1]:
      area = abs(point1[0] - point3[0])*abs(point1[1] - point3[1])
      print area
      sys.exit(0)
   elif point2[0] != point3[0] and point2[1] != point3[1]:
      area = abs(point2[0] - point3[0])*abs(point2[1] - point3[1])
      print area
      sys.exit(0)
   print -1
   sys.exit(0)
elif vert == 4:
   point1 = pt[0]
   point2 = pt[1]
   point3 = pt[2]
   point4 = pt[3]
   if point1[0] != point2[0] and point1[1] != point2[1]:
      area = abs(point1[0] - point2[0])*abs(point1[1] - point2[1])
      print area
      sys.exit(0)
   elif point1[0] != point3[0] and point1[1] != point3[1]:
      area = abs(point1[0] - point3[0])*abs(point1[1] - point3[1])
      print area
      sys.exit(0)
   elif point1[0] != point4[0] and point1[1] != point4[1]:
      area = abs(point1[0] - point4[0])*abs(point1[1] - point4[1])
      print area
      sys.exit(0)
   elif point2[0] != point3[0] and point2[1] != point3[1]:
      area = abs(point2[0] - point3[0])*abs(point2[1] - point3[1])
      print area
      sys.exit(0)
   elif point2[0] != point4[0] and point2[1] != point4[1]:
      area = abs(point2[0] - point4[0])*abs(point2[1] - point4[1])
      print area
      sys.exit(0)
   elif point3[0] != point4[0] and point3[1] != point4[1]:
      area = abs(point3[0] - point4[0])*abs(point3[1] - point4[1])
      print area
      sys.exit(0)
   print -1
   sys.exit(0)

import math
verno=int(raw_input())
pointlist= list()
for i in range(verno):
    point=map(int, raw_input().split())
    pointlist.append(point[0])
    pointlist.append(point[1])
#print pointlist

l=0
w=0
if verno==1:
    print -1

elif verno==2:
    if pointlist[0]!=pointlist[2] and pointlist[1]!=pointlist[3]:
        l= abs(pointlist[1] - pointlist[3])
        w= abs(pointlist[0] - pointlist[2])
        print l*w
    else:
        print -1

elif verno==3:
    if pointlist[0]==pointlist[2]:
        l= abs(pointlist[1] - pointlist[3])
        w= abs(pointlist[0] - pointlist[4])
    elif pointlist[0]==pointlist[4]:
        l= abs(pointlist[1] - pointlist[5])
        w= abs(pointlist[0] - pointlist[2])
    elif pointlist[2]==pointlist[4]:
        l= abs(pointlist[3] - pointlist[5])
        w= abs(pointlist[0] - pointlist[2])
    print l*w

elif verno==4:
    if pointlist[0]==pointlist[2]:
        l= abs(pointlist[1] - pointlist[3])
        w= abs(pointlist[0] - pointlist[4])
    elif pointlist[0]==pointlist[4]:
        l= abs(pointlist[1] - pointlist[5])
        w= abs(pointlist[0] - pointlist[2])
    elif pointlist[2]==pointlist[4]:
        l= abs(pointlist[3] - pointlist[5])
        w= abs(pointlist[0] - pointlist[2])
    if pointlist[0]==pointlist[6]:
        l= abs(pointlist[1] - pointlist[7])
        w= abs(pointlist[0] - pointlist[2])
    elif pointlist[2]==pointlist[6]:
        l= abs(pointlist[3] - pointlist[7])
        w= abs(pointlist[0] - pointlist[2])
    elif pointlist[2]==pointlist[4]:
        l= abs(pointlist[5] - pointlist[7])
        w= abs(pointlist[2] - pointlist[4])
    print l*w

a = raw_input()
a = int(a)

m = []
for i in xrange(a):
    temp = map(int, raw_input().split(' '))
    m.append(temp)
if a < 2:
    print -1
    exit()
elif a == 2:
    x,y = m
    if x[0] == y[0] or x[1] == y[1]:
        print -1
        exit()
else:
    x = m[0]
    y = False
    for i in m[1:]:
        if x[0] == i[0] or x[1] == i[1]:
            pass
        else:
            y = i
    if y:
        pass
    else:
        x = m[1]
        y = m[2]
print abs(x[0]-y[0])*abs(x[1]-y[1])

from sys import stdin
n=int(stdin.readline().strip())
s=[]
for i in range(n):

    a,b=map(int,stdin.readline().strip().split())
    s.append([a,b])
ans=-1
for i in range(n):
    for j in range(i+1,n):
        if( s[i][0]!=s[j][0] and  s[i][1]!=s[j][1] ):

            ans=abs(s[i][0]-s[j][0] )*  abs(s[i][1]-s[j][1] )
print(ans)

n = input()
res = []
for i in range(n):
	k = map(int, raw_input().strip().split(' '))
	res.append(k)
xma = -1111
yma = -1111
ymi = 1111
xmi = 1111
for x in res:
	xma = max(xma, x[0])
	xmi = min(xmi, x[0])
	yma = max(yma, x[1])
	ymi = min(ymi, x[1])
ans = (xma - xmi) * (yma - ymi)
if ans > 0:
	print ans
else:
	print -1

v = int(input())

def pl3(v):
    point = []
    for i in range(v):
        point.append(input().split())
    for k in point:
        for j in point:
            if k[0] != j[0] and k[1] != j[1]:
                return abs((int(k[0])-int(j[0]))*(int(k[1])-int(j[1])))
                break
    return -1

if v == 1:
    print('-1')
else:
    print(pl3(v))

import sys

def main(argv):
	num = int(raw_input())

	if num < 2:
		print "-1"
		sys.exit()

	points = list()
	for x in xrange(num):
		pos = [int(item) for item in raw_input().split(' ')]
		points.append(pos)

	if num == 2:
		if points[0][0] == points[1][0] or points[0][1] == points[1][1]:
			print "-1"
			sys.exit()

	len1 = 0
	len2 = 0
	index = 0
	while len1 == 0 or len2 == 0:
		if points[index][0] != points[index + 1][0]:
			len1 = abs(points[index][0] - points[index + 1][0])

		if points[index][1] != points[index + 1][1]:
			len2 = abs(points[index][1] - points[index + 1][1])
		index += 1

	print repr(len1 * len2)

if __name__ == "__main__":
	main(sys.argv)

#!/usr/bin/python

from collections import deque

def ir():
    return int(raw_input())

def ia():
    line = raw_input()
    line = line.split()
    return map(int, line)

n = ir()

def smin(a, b):
    if   a==None: return b
    elif b==None: return a
    else        : return min(a, b)

def smax(a, b):
    if   a==None: return b
    elif b==None: return a
    else        : return max(a, b)

x_mi = x_ma = y_mi = y_ma = None
for i in range(n):
    x, y = ia()
    x_ma  = smax(x, x_ma); x_mi  = smin(x, x_mi);
    y_ma  = smax(y, y_ma); y_mi  = smin(y, y_mi);

rc = \
     x_ma!=None and x_mi!=None and y_ma!=None and y_mi!=None and x_ma!=x_mi and y_ma!=y_mi

print (x_ma-x_mi)*(y_ma-y_mi) if rc else -1

n=input()
a=set()
b=set()
for _ in xrange(n):
    t=map(int,raw_input().split())
    a.add(t[0])
    b.add(t[1])
ans=-1
if len(a)==2 and len(b)==2:
    a=list(a)
    b=list(b)
    a.sort()
    b.sort()
    ans=(b[1]-b[0])*(a[1]-a[0])
print ans

n = int(input())
if n == 1:
    print(-1)
    exit()
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())
if n == 2:
    if x[0] == x[1] or y[0] == y[1]:
        print(-1)
    else:
        print(abs(x[0]-x[1]) * abs(y[0]-y[1]))
else:
    for i in range(n):
        for j in range(n):
            if x[i] != x[j] and y[i] != y[j]:
                print(abs(x[i]-x[j]) * abs(y[i]-y[j]))
                exit()

n = int(raw_input())

xs = []
ys = []
for i in range(n):
    s = raw_input().split(" ")
    x = int(s[0])
    y = int(s[1])
    xs.append(x)
    ys.append(y)

ans = -1

for i in range(n):
    x1 = xs[i]
    y1 = ys[i]
    for j in range(i, n):
        x2 = xs[j]
        y2 = ys[j]
        if x1 != x2 and y1 != y2:
            ans = abs(x2-x1)*abs(y2-y1)
            break
print ans

# -*- coding: utf-8 -*-
"""
Created on Sun Nov 15 19:36:30 2015

@author: fedor
"""

n_vert = input()
vert = []
for i in xrange(n_vert):
    vert.append(map(int, raw_input().strip().split()))
if n_vert == 1:
    print(-1)
elif n_vert == 2:
    x1, y1 = vert[0]
    x2, y2 = vert[1]
    if x1 != x2 and y1 != y2:
        square = abs(x2 - x1)*abs(y2 - y1)
        print(square)
    else:
        print(-1)
else:
    x, y = zip(*vert)
    x_max = max(x)
    x_min = min(x)
    y_max = max(y)
    y_min = min(y)
    square = (x_max - x_min)*(y_max - y_min)
    print(square)

sx = set()
sy = set()
n = int(raw_input())

while n>0:
    n-=1
    x,y=map(int,raw_input().split())
    sx.add(x)
    sy.add(y)
if len(sx) == 2 and len(sy)==2 :
    print abs(sx.pop()-sx.pop())*abs(sy.pop()-sy.pop())
else:
    print"-1"

# import sys
# sys.stdin = open('cf596a.in')

from collections import namedtuple

n = int(input())

Point = namedtuple("Point", "x y")

pts = [Point(*map(int, input().split())) for _ in range(n)]

if n == 1:
	print(-1)
elif n == 2:
	if pts[0].x == pts[1].x or pts[0].y == pts[1].y:
		print(-1)
	else:
		print(abs((pts[1].x - pts[0].x) * (pts[0].y - pts[1].y)))
else:
	diffs_x = set()
	diffs_y = set()
	for i in range(n - 1):
		for j in range(i + 1, n):
			diffs_x.add(abs(pts[i].x - pts[j].x))
			diffs_y.add(abs(pts[i].y - pts[j].y))
	diffs_x -= set([0])
	diffs_y -= set([0])
	print(diffs_x.pop() * diffs_y.pop())

n=int(input())
ip1=[]
ip2=[]
for i in range(n):
    a,b=map(int,input().split())
    ip1.append(a)
    ip2.append(b)
if n<=1:
    print(-1)
elif n>=3:
    ip1=sorted(ip1)
    ip2=sorted(ip2)
    print(abs(ip1[-1]-ip1[0])*abs(ip2[-1]-ip2[0]))
else:
    a,b=ip1[0],ip2[0]
    c,d=ip1[1],ip2[1]
    if a==c or b==d:
        print(-1)
    else:
        print(abs(c-a)*abs(d-b))

#!/usr/bin/python3

n = int(input())
arr = [tuple(map(int, input().split())) for i in range(n)]
arr.sort()

mna = 1791
mxa = -1791
mnb = 1791
mxb = -1791
for i in range(n):
    mna = min(mna, arr[i][0])
    mnb = min(mnb, arr[i][1])
    mxa = max(mxa, arr[i][0])
    mxb = max(mxb, arr[i][1])

if mna == mxa or mnb == mxb:
    print(-1)
else:
    print((mxa - mna) * (mxb - mnb))

def main():
	n = input()
	if n == 1:
		print '-1'
		return

	vertex = []
	for _ in xrange(n):
		x,y = map(int, raw_input().split())
		vertex += [(x,y)]

	l=0
	h=0
	for i in xrange(n):
		for j in xrange(i+1,n):
			if vertex[i][0] != vertex[j][0]:
				l = abs(vertex[i][0]-vertex[j][0])
			if vertex[i][1] != vertex[j][1]:
				h = abs(vertex[i][1]-vertex[j][1])

	if l==0 or h==0:
		print -1
		return

	print l*h

if __name__ == '__main__':
	main()

def Respuesta(X,Y):
    X1 = list(set(X))
    Y1 = list(set(Y))
    if (len(X1)== 2 and len(Y1)==2):
        return abs((Y1[1]-Y1[0])*(X1[1]-X1[0]))
    else:
        return -1

n = int(input())
X = []
Y = []
for i in range (0,n):
    L = input()
    L =L.split()
    X.append(int(L[0]))
    Y.append(int(L[1]))

if n==1:
    print(-1)
else:
    print(Respuesta(X,Y))

x = set()
y = set()
for _ in range(int(raw_input())):

    a,b = map(int,raw_input().split())
    x.add(a)
    y.add(b)
x=list(x)
y = list(y)

if len(x)==2 and len(y)==2:
    print abs((x[1]-x[0])*(y[1]-y[0]))
else:
    print -1

N=int(input())
if N<2:
    print(-1)
elif N==2:
    a=tuple(map(int,input().split()))
    b=tuple(map(int,input().split()))
    if a[0]!=b[0] and a[1]!=b[1]:
        print(abs(b[0]-a[0])*abs(b[1]-a[1]))
    else:
        print(-1)
elif N==3:
    a=tuple(map(int,input().split()))
    b=tuple(map(int,input().split()))
    c=tuple(map(int,input().split()))
    print(abs((max(a[0],b[0],c[0])-min(a[0],b[0],c[0]))*(max(a[1],b[1],c[1])-min(a[1],b[1],c[1]))))
else:
    a=tuple(map(int,input().split()))
    b=tuple(map(int,input().split()))
    c=tuple(map(int,input().split()))
    d=tuple(map(int,input().split()))
    print(abs((max(a[0],b[0],c[0])-min(a[0],b[0],c[0]))*(max(a[1],b[1],c[1])-min(a[1],b[1],c[1]))))

n=int(input())
l=[]
if n==0:
    print("-1")
else:
    for i in range(n):
        x,y=map(int,input().split())
        l+=[[x,y]]
if n==1 :
    print("-1")
else:
    c=0
    for i in range(n-1):
        j=i+1
        while j<n:
            if l[j][0]!=l[i][0] and l[j][1]!=l[i][1]:
                result=(l[i][0]-l[j][0])*(l[i][1]-l[j][1])
                c=1
                break
            j+=1
        if c:
            if result<0:
                print(-result)
            else:
                print(result)
            break
    if not c:
        print('-1')

n=int(input())
x=n*[0]
y=n*[0]
for i in range(n):
    x[i],y[i]=[int(i) for i in input().split()]
if n==1:
    print(-1)
else:
    if n==2:
        if x[0]==x[1] or y[0]==y[1]:
            print(-1)
        else:
            print(abs((x[0]-x[1])*(y[0]-y[1])))
    elif n==3 or n==4:
        x.sort()
        y.sort()
        print(abs((max(x)-min(x))*(max(y)-min(y))))

v=zip(*[map(int,raw_input().split()) for _ in range(input())])
print (max(v[0])-min(v[0]))*(max(v[1])-min(v[1])) or -1

__author__ = 'abd el rahman'
n = int(raw_input())
if n ==1:
    print -1
elif n ==2:
    x1,y1 = map(int ,raw_input().split())
    x2,y2 = map(int ,raw_input().split())

    if x1 == x2 or y1 == y2:
        print -1
    else:
        print abs((x2-x1) * (y2-y1))

else:
    x= [0]*n
    y = [0]*n
    for i in range(0,n):
        x[i],y[i] = map(int , raw_input().split())
    x = sorted(x)
    y = sorted(y)
    print abs((x[0]- x[-1]) * (y[0]-y[-1]))

def check(a, b):
    return a[0] != b[0] and a[1] != b[1]

def S(a, b):
    return abs(a[0] - b[0]) * abs(a[1] - b[1])

n = int(input())
points = list(tuple(map(int, input().split())) for i in range(n))

if n == 1:
    print(-1)

elif n == 2:
    print(S(points[0], points[1])) if check(points[0], points[1]) else print(-1)

else:
    for i in range(n):
        for j in range(i + 1, n):
            if check(points[i], points[j]):
                print(S(points[i], points[j]))
                exit()

    print(-1)

n = int(input())
x = []
y = []
area = 0
for i in range(n):
    li = list(map(int, input().strip().split(" ")))
    x.append(li[0])
    y.append(li[1])
result = ((max(x)-min(x))*(max(y)-min(y)))
print(result if result > 0 else -1)

sx = set()
sy = set()
n = int(raw_input())

while n>0:
    n-=1
    x,y=map(int,raw_input().split())
    sx.add(x)
    sy.add(y)
if len(sx) == 2 and len(sy)==2 :
    print abs(sx.pop()-sx.pop())*abs(sy.pop()-sy.pop())
else:
    print"-1"

# -*- coding: utf-8 -*-
n = int(raw_input())
x, y = set(), set()

if n == 1:
    print('-1')
else:
    for i in xrange(n):
        _x, _y = map(int, raw_input().split(' '))
        x.add(_x)
        y.add(_y)
    if len(x) > 1 and len(y) > 1:
        x = list(set(x))
        y = list(set(y))
        print(abs(x[0]-x[1])*abs(y[0]-y[1]))
    else:
        print('-1')

n = int(input())
if (n == 1):
    print(-1)
elif (n == 2):
    x1, y1 = map(int, input().split())
    x2, y2 = map(int, input().split())
    if (x1 == x2) or (y1 == y2):
        print(-1)
    else:
        print(abs(x2 - x1) * abs(y2 - y1))
else:
    x1, y1 = map(int, input().split())
    x2, y2 = map(int, input().split())
    x3, y3 = map(int, input().split())
    if (x1 == x2) or (y1 == y2):
        if (x1 == x3) or (y1 == y3):
            print(abs(x3 - x1) * abs(y3 - y1))
        else:
            print(abs(x3 - x2) * abs(y3 - y2))
    else:
        print(abs(x2 - x1) * abs(y2 - y1))

n=int(input())
if n==1:
    print(-1)
    exit()
if n==2:
    x1,y1=map(int,input().split())
    x2,y2=map(int,input().split())
    if x1==x2 or y1==y2:
        print(-1)
        exit()
    print(abs(x1-x2)*abs(x1-x2))
    exit()
if n==3:
    x1,y1=map(int,input().split())
    x2,y2=map(int,input().split())
    x3,y3=map(int,input().split())
    if x1==x2:
        l=abs(y2-y1)
        b=abs(x3-x1)
        print(l*b)
        exit()
    if x2==x3:
        l=abs(y3-y2)
        b=abs(x1-x3)
        print(l*b)
    if x1==x3:
        l=abs(y1-y3)
        b=abs(x2-x1)
        print(l*b)
    exit()
if n==4:
    points=[]
    for i in range(4):
        a,b=map(int,input().split())
        points.append([a,b])
    for i in range(4):
        for j in range(i+1,4):
            if points[i][0]!=points[j][0] and points[i][1]!=points[j][1]:
                print(abs(points[i][0]-points[j][0])*abs(points[i][1]*points[j][1]))
                exit()

#map(int,raw_input().split())
n = int(raw_input())
p = []
for i in xrange(n):
    p.append(tuple(map(int,raw_input().split())))

p.sort()

if len(p) == 1:
    print -1
else:
    if len(p) >= 3:
        x1,y1 = p[0]
        x2,y2 = p[1]
        x3,y3 = p[2]
        ans = [0,0]
        if (x1 == x2):
            ans[0]= abs(y1-y2)
        else:
            ans[0] = abs(y3-y1)
        if (y1 == y2):
            ans[1] = abs(x1-x2)
        else:
            ans[1] = abs(x3-x2)
        print ans[0]*ans[1]
    else:
        x1,y1 = p[0]
        x2,y2 = p[1]
        if (x1 != x2) and (y1!=y2):
            print (abs(x1-x2) * abs(y1-y2))
        else:
            print -1

N = int(raw_input())

if N == 1:
	print -1
	exit()
A = []
B = []
for _ in range(N):
	tmp = map(int, raw_input().split())
	A.append(tmp[0])
	B.append(tmp[1])

if A[0] != B[0] and A[1] != B[1]:
	print 1
else:
	print -1

g = int(input())
if g > 2:
	print(1)
elif g  == 2:
	lst = []
	for i in range(g):
		h = list(map(int, input().split()))
		lst.append(h)
	if lst[0][0] !=  lst[1][0] and lst[0][1] != lst[1][1]:
		print(1)
	else:
		print(-1)
elif g == 1:
	print(-1)

def solve():
    import math
    r=raw_input
    t=int(r())
    if t == 1:
        print -1
        exit()
    if t == 2:
        l = []
        for _ in xrange(t):
            x,y = map(int,r().split())
            l.append((x,y))
        if l[0][0] == l[1][0] or l[0][1] == l[1][1]:
            print -1
            exit()
        print ( abs(l[0][0]-l[1][0]) * abs(l[0][1]-l[1][1]) )
        exit()
    else:
        l = []
        for _ in xrange(t):
            x,y = map(int,r().split())
            l.append((x,y))
        l.sort()
        i = 0
        j = len(l)-1
        if l[i][0]!=l[j][0] and l[i][1]!=l[j][1]:
            print ( abs(l[i][0]-l[j][0]) * abs(l[i][1]-l[j][1]) )
            exit()
        print -1
        exit()
solve()

import sys

def check_point(c, d):
    if c[0] != d[0] and c[1] != d[1]:
        return True
    else:
        return False

def square(c, d):
    return abs(c[0] - d[0]) * abs(c[1] - d[1])

n = int(input())
a = []
q = 0
h = 0
for x in range(n):
    a.append(list(map(int, input().split())))
if n == 2:
    if check_point(a[0], a[1]):
        print(square(a[0], a[1]))
    else:
        print(-1)
elif n == 3:
    if check_point(a[0], a[1]):
        print(square(a[0], a[1]))
    elif check_point(a[0], a[2]):
        print(square(a[0], a[2]))
    elif check_point(a[2], a[1]):
        print(square(a[1], a[2]))
    else:
        print(-1)
elif n == 4:
    if check_point(a[0], a[1]) and check_point(a[2], a[3]):
        print(square(a[0], a[1]))
    elif check_point(a[1], a[2]) and check_point(a[0], a[3]):
        print(check_point(a[1], a[2]))
    elif check_point(a[0], a[2]) and check_point(a[1], a[3]):
        print(check_point(a[0], a[2]))

else:
    print(-1)

n=int(input())
vertice=[]
for i in range(n):
    v=list(map(int,input().split()))
    vertice.append(v)
if n==1:
    print(-1)
else:
    ans=[]
    if n>=2:
        area=abs(vertice[0][0]-vertice[1][0])*abs(vertice[0][1]-vertice[1][1])
        ans.append(area)
    if n>=3:
        area=abs(vertice[0][0]-vertice[2][0])*abs(vertice[0][1]-vertice[2][1])
        ans.append(area)
        area=abs(vertice[1][0]-vertice[2][0])*abs(vertice[1][1]-vertice[2][1])
        ans.append(area)
    if n>=4:
        area=abs(vertice[0][0]-vertice[3][0])*abs(vertice[0][1]-vertice[3][1])
        ans.append(area)
        area=abs(vertice[1][0]-vertice[3][0])*abs(vertice[1][1]-vertice[3][1])
        ans.append(area)
        area=abs(vertice[2][0]-vertice[3][0])*abs(vertice[2][1]-vertice[3][1])
        ans.append(area)
    ans.sort(reverse=True)
    print(ans[0])

n=int(raw_input())
a=[]
b=[]
for i in range(n):
    p,q=map(int,raw_input().split())
    a.append(p)
    b.append(q)
if n==1:
    print -1
elif n==2:
    print abs(a[1]-a[0])*abs(b[1]-b[0])
else:
    a=list(set(a))
    b=list(set(b))
    print abs(a[1]-a[0])*abs(b[1]-b[0])

n=int(input())
s=[]
if n==1 :
    s.append(input())
    print(-1)
else :
    for k in range (0,n):
        s.append(input().split())
    xmax=-1100
    xmin=1100
    for k in range(0,n) :
        if int(s[k][0])>xmax :
            xmax=int(s[k][0])
        if int(s[k][0])<xmin :
            xmin=int(s[k][0])
    x=xmax-xmin

    ymax=-1110
    ymin=1100
    for k in range(0,n) :
        if int(s[k][1])>ymax :
            ymax=int(s[k][1])
        if int(s[k][1])<ymin :
            ymin=int(s[k][1])
    y=ymax-ymin

    print(x*y)

def solve(n, verts):
	if n == 1:
		return -1
	if n == 2:
		if verts[0][0] == verts[1][0] or verts[0][1] == verts[1][1]:
			return -1
		else:
			return abs(verts[0][0] - verts[1][0]) * abs(verts[0][1] - verts[1][1])
	if n == 3 or n == 4:
		lowest = [100000, 100000]
		biggest = [-100000, -10000]
		for i in verts:
			if i[0] <= lowest[0] and i[1] <= lowest[1]:
				lowest = i
		for i in verts:
			if i[0] >= biggest[0] and i[1] >= biggest[1]:
				biggest = i
		return abs(biggest[0] - lowest[0]) * abs(biggest[1] - lowest[1])

n = int(raw_input())
verts = [map(int, raw_input().split()) for i in range(n)]
print solve(n, verts)

import math as mt
import sys,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
def dist(x,y,c,d):
    return mt.sqrt((x-c)**2+(y-d)**2)
def circle(x1, y1, x2,y2, r1, r2):

    distSq = (((x1 - x2)* (x1 - x2))+ ((y1 - y2)* (y1 - y2)))**(.5)

    if (distSq + r2 <= r1):
        return True
    else:
        return False

n=I()
if(n==1):
    c,d=M()
    print(-1)
elif(n==2):
    a,b=M()
    c,d=M()
    x=abs(a-c)*abs(b-d)
    if(x):
        print(x)
    else:
        print(-1)
else:
    d=[]
    for i in range(n):
        a,b=M()
        d.append([a,b])
    d.sort(key=lambda x:x[0])
    d.append(d[0])
    x=0
    for i in range(n):
       x+=d[i][0]*d[i+1][1]
       x-=d[i][1]*d[i+1][0]
    if(n==3):
        print(abs(x))
    if(n==4):
        print(abs(x)//2)

n=int(input())
to=[]
if n==1:
    print(-1)
elif n==2:
    for x in range(2):
        l,k=input().split()
        to.append(int(l))
        to.append(int(k))
    if to[0]!=to[2] and to[1]!=to[3]:
        print(abs(to[0]-to[2])*abs(to[1]-to[3]))
    else:
        print(-1)
elif n==3:
    for x in range(3):
        l,k=input().split()
        to.append(int(l))
        to.append(int(k))
    if to[0]!=to[2] and to[1]!=to[3]:
        print(abs(to[0]-to[2])*abs(to[1]-to[3]))
    elif to[0]!=to[4] and to[1]!=to[5]:
        print(abs(to[0]-to[4])*abs(to[1]-to[5]))
    else:
        print(abs(to[2]-to[4])*abs(to[3]-to[5]))
else:
    for x in range(4):
        l,k=input().split()
        to.append(int(l))
        to.append(int(k))
    if to[0]!=to[2] and to[1]!=to[3]:
        print(abs(to[0]-to[2])*abs(to[1]-to[3]))
    elif to[0]!=to[3] and to[1]!=to[5]:
        print(abs(to[0]-to[3])*abs(to[1]-to[5]))
    else:
        print(abs(to[0]-to[6])*abs(to[1]-to[7]))

class CodeforcesTask596ASolution:
    def __init__(self):
        self.result = ''
        self.n = 0
        self.points = []

    def read_input(self):
        self.n = int(input())
        for x in range(self.n):
            self.points.append([int(y) for y in input().split(" ")])

    def process_task(self):
        if self.n < 2:
            self.result = "-1"
        elif self.n == 2:
            if self.points[0][0] != self.points[1][0] and self.points[0][1] != self.points[1][1]:
                self.result = str(abs(self.points[0][0] - self.points[1][0]) * abs(self.points[1][1] - self.points[0][1]))
            else:
                self.result = "-1"
        else:
            xs = [x[0] for x in self.points]
            ys = [x[1] for x in self.points]
            xs.sort()
            ys.sort()
            self.result = str(abs(self.points[0][0] - self.points[-1][0]) * abs(self.points[-1][1] - self.points[0][1]))

    def get_result(self):
        return self.result

if __name__ == "__main__":
    Solution = CodeforcesTask596ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())

v = int(input())

def pl3(v):
    point = []
    for i in range(v):
        point.append(input().split())
    for k in point:
        for j in point:
            if k[0] != j[0] and k[1] != j[1]:
                return abs((int(k[0])-int(j[0]))*(int(k[1])-int(j[1])))

if v == 1:
    print('-1')
elif v == 3:
    print(pl3(v))
elif v == 4:
    print(pl3(v))
else:
    print(pl3(v))

# Description of the problem can be found at http://codeforces.com/problemset/problem/596/A

d_y = {}
d_x = {}

l_c = list()
l_c = list()

n = int(input())

for _ in range(n):
    x, y = map(int, input().split())
    d_x[x] = 1
    d_y[y] = 1
    l_c.append([x, y])

if len(d_x) + len(d_y) < 4:
    print(-1)
    quit()

t_x = 0
t_y = 0
i = 1
for k_x in d_x:
    t_x += (-1 if i == 0 else 1) * k_x
    i = 0
i = 1
for k_y in d_y:
    t_y += (-1 if i == 0 else 1) * k_y
    i = 0

print(t_x * t_y)

def check(a, b):
    return a[0] != b[0] and a[1] != b[1]

def S(a, b):
    return abs(a[0] - b[0]) * abs(a[1] - b[1])

n = int(input())
points = list(tuple(map(int, input().split())) for i in range(n))

if n == 1:
    print(-1)

elif n == 2:
    print(S(points[0], points[1])) if check(points[0], points[1]) else print(-1)

else:
    for i in range(n):
        for j in range(i + 1, n):
            if check(points[i], points[j]):
                print(S(points[i], points[j]))
                exit()

print(-1)

n = int(raw_input())

c = []
for i in xrange(n):
    c.append(tuple(int(i) for i in raw_input().split(" ")))

x1 = c[0][0]
y1 = c[0][1]

x2 = None
y2 = None

for p in c[1:]:
    if p[0] != x1:
        x2 = p[0]
    if p[1] != y1:
        y2 = p[0]

if x2 is None or y2 is None:
    print -1
else:
    w = abs(x1 - x2)
    h = abs(y1 - y2)
    print w * h

count = int(raw_input())

coords = []
for i in range(count):
    vals = map(int,raw_input().split(" "))
    coords.append((vals[0],vals[1]))

coords.sort()

if len(coords) == 4:
    print (coords[2][0] - coords[0][0]) * (coords[1][1] - coords[0][1])
elif len(coords) == 3:
    val = (coords[2][0] - coords[0][0]) * (coords[2][1] - coords[0][1])
    val1 = abs((coords[1][0] - coords[0][0]) * (coords[1][1] - coords[0][1]))
    val2 = abs((coords[2][0] - coords[1][0]) * (coords[2][1] - coords[1][1]))
    temp_m = max(val,val1)
    print max(val2, temp_m)
elif len(coords) == 2:
    val = (coords[1][0] - coords[0][0]) * (coords[1][1] - coords[0][1])
    if val == 0:
        print -1
    else:
        print val
else:
    print -1

def arr_2d(n):
    return [[int(x) for x in input().split()] for i in range(n)]

def euclidean(x1, x2, y1, y2):
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

def get_col(arr, i):
    return [row[i] for row in arr]

from math import *
from operator import *

n = int(input())
a = arr_2d(n)

if n == 1:
    print(-1)
elif n == 2 and a[0][0] == a[1][0] or a[0][1] == a[1][1]:
    print(-1)
else:
    a = [list(set(get_col(a, 0))), list(set(get_col(a, 1)))]
    # print(a)
    print(abs(a[0][0] - a[0][1]) * abs(a[1][1] - a[1][0]))

n = int(raw_input())
pt = map(int, raw_input().split(' '))
minx = maxx = pt[0]
miny = maxy = pt[0]

if n > 1:
	for i in range(n - 1):
		pt = map(int, raw_input().split())
		if pt[0] < minx: minx = pt[0]
		if pt[0] > maxx: maxx = pt[0]
		if pt[1] < miny: miny = pt[0]
		if pt[1] > maxy: maxy = pt[0]

area = (maxx - minx) * (maxy - miny)
if area > 0:
	print area
else:
	print -1

def arr_2d(n):
    return [[int(x) for x in input().split()] for i in range(n)]

def euclidean(x1, x2, y1, y2):
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

from math import *
from operator import *

n = int(input())
a = sorted(arr_2d(n), key=itemgetter(0,1))
# print(a)

if n == 1:
    print(-1)
elif n == 2 and a[0][0] == a[1][0] or a[0][1] == a[1][1]:
    print(-1)
else:
    print(abs(a[0][0] - a[-1][0]) * abs(a[-1][1] - a[0][1]))

n=int(input())
liste=[]
for i in range(n):
    tempo=[int(element) for element in input().split(" ")]
    liste.append(tempo)

if n==1 or liste[0][0]==liste[1][0] or liste[0][1]==liste[1][1]:
    print(-1)
else:
    answer=(liste[0][0]-liste[1][0])*(liste[0][1]-liste[1][1])
    print(answer)

n = int(input())
coords = []
for i in range(n):
    coords.append([int(i) for i in input().split()])
if n == 1:
    print(-1)
elif n == 2:
    if coords[0][0] != coords[1][0] and coords[0][1] != coords[1][1]:
        print(abs((coords[0][0]-coords[1][0]) * coords[0][1]-coords[1][1]))
    else:
        print(-1)
else:
    r = 0
    for coord1 in coords:
        for coord2 in coords:
            if coord1[0] != coord2[0] and coord1[1] != coord2[1]:
                print(abs((coord1[0]-coord2[0]) * (coord1[1]-coord2[1])))
                r = 1
                break
        if r == 1:
            break

x = set()
y = set()
for _ in range(int(raw_input())):

    a,b = map(int,raw_input().split())
    x.add(a)
    y.add(b)
x=list(x)
y = list(y)

if len(x)==2 and len(y)==2 and (x[1]-x[0])*(y[1]-y[0]):
    print 1
else:
    print -1

n=int(raw_input())
x=[]
y=[]
for i in range(n):
    xi,yi=map(int,raw_input().strip().split())
    x.append(xi)
    y.append(yi)
if n==1:
    print '-1'
else:
    x.sort()
    y.sort()
    print abs(x[0]-x[-1])*abs(y[0]-y[-1])

n=int(input())
s=[]
if n==1 :
    s.append(input())
    print(-1)
else :
    for k in range (0,n):
        s.append(input().split())
    xmax=-1
    xmin=1100
    for k in range(0,n) :
        if int(s[k][0])>xmax :
            xmax=int(s[k][0])
        if int(s[k][0])<xmin :
            xmin=int(s[k][0])
    x=xmax-xmin

    ymax=-1
    ymin=1100
    for k in range(0,n) :
        if int(s[k][1])>ymax :
            ymax=int(s[k][1])
        if int(s[k][1])<ymin :
            ymin=int(s[k][1])
    y=ymax-ymin

    print(x*y)

n=int(input())
r=range(0,n)
items = []
for l in r:
	s=raw_input()
	s=s.split(' ')
	x=int(s[0])
	y=int(s[1])
	items.append((x,y))

if n == 1:
	print "-1"
elif n == 2:
	if items[0][0] == items[1][0] or items[0][1] == items[1][1]:
		print "-1"
	else:
		area = (items[0][1] - items[1][1]) * (items[0][0] - items[1][0])
		print area
else:
	w = max(abs(items[0][1]-items[1][1]), abs(items[1][1]-items[2][1]), abs(items[0][1]-items[2][1]))
	v = max(abs(items[0][0]-items[1][0]), abs(items[1][0]-items[2][0]), abs(items[0][0]-items[2][0]))
	print w*v

n = int(input())
coordinates = [tuple(map(int, (input().split()))) for i in range(n)]
if n == 3:
    coordinates.sort()
    s = ((coordinates[0][1]-coordinates[1][1])**2+(coordinates[0][0]-coordinates[1][0])**2)**0.5*((coordinates[1][1]-coordinates[2][1])**2+(coordinates[1][0]-coordinates[2][0])**2)**0.5
elif n == 2 and coordinates[0][0]!=coordinates[1][0] and coordinates[0][1]!=coordinates[1][1]:
    s = abs((coordinates[0][0]-coordinates[1][0])*(coordinates[0][1]-coordinates[1][1]))
else:
    s = -1
print(s)

import sys

num_verts = int(sys.stdin.readline())

verts = []
for _ in range(num_verts):
    # read verts
    x, y = [int(x) for x in sys.stdin.readline().split()]
    verts.append((x, y))

v0 = verts[0]
v1 = None
for i in range(1, num_verts):
    if verts[i][0] != v0[0] and verts[i][1] != v0[1]:
        v1 = verts[i]
        break

if not v1:
    print -1
else:
    print abs(v0[0] - v1[0]) * abs(v0[1] - v1[1])

n=int(raw_input())
x=[]
y=[]
for h in range(n):
    a,b=map(int,raw_input().split())
    if n==1:
        print -1
        exit()
    else:
        x.append(a)
        y.append(b)
if len(x)>2:
    if x[0]==x[1]:
        raa=x[0]-x[2]
        rbb=y[0]-y[1]
        faa=raa*rbb
        if faa==0:
            print -1
            exit()
        else:
            print abs(faa)
    elif x[0]!=x[1]:
        rr=x[0]-x[1]
        rrr=y[0]-y[1]
        fff=rr*rrr
        print abs(fff)
    elif y[0]!=y[1]:
        gg=x[0]-x[1]
        ggg=y[0]-y[1]
        fds=gg*ggg
        print abs(fds)
    elif y[0]==y[1]:
        ra=y[0]-y[2]
        rb=x[0]-x[1]
        fb=ra*rb
        if fb==0:
            print -1
            exit()
        else:
            print abs(fb)
else:
    res=x[0]-x[1]
    res2=y[0]-y[1]
    f=res*res2
    if f==0:
        print -1
        exit()
    else:
        print abs(f)

n=int(input())
xfound=[]
yfound=[]
for i in range(n):
    x0,y0=map(int,input().split())
    if x0 not in xfound:
        xfound.append(x0)
    if y0 not in yfound:
        yfound.append(y0)
print(1 if(len(xfound)==2 and len(yfound)==2) else -1)

l, r = [], [-1]
for _ in range(int(input())):
    a, b = map(int, input().split())
    for c, d in l:
        r.append(abs((a - c) * (b - d)))
    l.append((a, b))
print(max(r))

n = int(input())

a = set()
b = set()
for i in range(0, n):
    x, y = map(int, input().split())
    a.add(x)
    b.add(y)
if n < 2:
    print(-1)
else:
    p = a.pop()
    q = a.pop()
    r = b.pop()
    s = b.pop()
    c = p - s
    d = q - r
    print(abs(d * c))

N = int(raw_input())
assert N >= 1 and N <= 4
coordinates = []

def check(N):
    for i in range(N):
        if N == 1:
            return -1

        else:
            c = tuple(map(int, raw_input().split()))
            assert c[0] >= -1000 and c[0] <= 1000
            assert c[1] >= -1000 and c[1] <= 1000
            coordinates.append(c)
    for i in range(1, len(coordinates)):
        if coordinates[0][0] != coordinates[i][0] and coordinates[0][1] != coordinates[i][1]:
            return abs(coordinates[0][0] - coordinates[i][0]) * abs(coordinates[0][1] - coordinates[i][1])

    return -1

print check(N)

n = int(input())
coordinates = [tuple(map(int, (input().split()))) for i in range(n)]
if n == 4:
    coordinates.sort()
    s = int(((coordinates[0][1]-coordinates[1][1])**2+(coordinates[0][0]-coordinates[1][0])**2)**0.5*((coordinates[1][1]-coordinates[3][1])**2+(coordinates[1][0]-coordinates[3][0])**2)**0.5)
elif n == 3:
    coordinates.sort()
    s = int(((coordinates[0][1]-coordinates[1][1])**2+(coordinates[0][0]-coordinates[1][0])**2)**0.5*((coordinates[1][1]-coordinates[2][1])**2+(coordinates[1][0]-coordinates[2][0])**2)**0.5)
elif n == 2 and coordinates[0][0]!=coordinates[1][0] and coordinates[0][1]!=coordinates[1][1]:
    s = abs((coordinates[0][0]-coordinates[1][0])*(coordinates[0][1]-coordinates[1][1]))
else:
    s = -1
print(s)

def niten(a,b): return abs(a-b) if a>=0 and b>=0 else  a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b))
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b/gcd(a,b)
def euclid_dis(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1.e-10 else 0

n=int(raw_input())
if n==1:
    print -1
elif n==2:
    a,b=map(int,raw_input().split())
    c,d=map(int,raw_input().split())
    if a==c or b==d:
        print -1
    else:
        print abs(max(a,c)-min(a,c))*abs(max(b,d)-min(b,d))
elif n==3:
    l=[]
    for i in range(3):
        l.append(map(int,raw_input().split()))
    l.sort()
    if l[0][0]==l[1][0] and l[1][1]==l[2][1]:
        x=niten(l[0][0],l[2][0])
        y=niten(l[0][1],l[1][1])
    elif l[0][1]==l[1][1] and l[1][0]==l[2][0]:
        x=niten(l[0][0],l[2][0])
        y=niten(l[0][1],l[2][1])
    else:
        x,y=1,-1
    print x*y
else:
    l=[]
    for i in range(4):
        l.append(map(int,raw_input().split()))
    l.sort()
    if l[0][0]==l[1][0] and l[2][0]==l[3][0] and l[0][1]==l[2][1] and l[1][1]==l[3][1]:
        x=niten(l[0][0],l[2][0])
        y=niten(l[0][1],l[1][1])
    else:
        x,y=1,-1
    print x*y

n=int(input())
r=[]
for j in range(n):
    (q,w)=(int(j) for j in input().split())
    r.append([q,w])
if n==1:
    print('-1')
else:
    if n==2:
        if r[0][0]!=r[1][0] and r[0][1]!=r[1][1]:
            print('1')
        else:
            print('-1')
    else:
        print('1')

n = int(input())

points = list()

for i in range(n):
    points.append(list(map(int, input().split())))

points.sort()

if n <= 1:
    print(-1)
elif n == 2:
    if points[0][0] != points[1][0] and points[0][1] != points[1][1]:
        print(abs((points[0][0] - points[1][0]) * (points[0][1] - points[1][1])))
    else:
        print(-1)
elif n == 3:
    if (points[0][0] == points[1][0]) and (points[1][1] == points[2][1]):
        print(abs((points[0][1] - points[1][1]) * (points[0][0] - points[2][0])))
    else:
        print(-1)
elif n == 4:
    if (points[0][0] == points[1][0]) and \
       (points[2][0] == points[3][0]) and \
       (points[0][1] == points[2][1]) and \
       (points[1][1] == points[3][1]):
        print(abs((points[0][1] - points[1][1]) * (points[0][0] - points[2][0])))
    else:
        print(-1)

n = int(input())
lst_x = []
lst_y = []
output = -1
for _ in range(n):
    x,y = map(int, input().split())
    if x not in lst_x and y not in lst_y:
        lst_x.append(x)
        lst_y.append(y)
    if len(lst_x) == 2:
        output = abs(lst_x[0] - lst_x[1]) * abs(lst_y[0] - lst_y[1])
print(output)

def check(a, b):
    return a[0] != b[0] and a[1] != b[1]

def S(a, b):
    return abs(a[0] - b[0]) * abs(a[1] - b[1])

n = int(input())
points = list(tuple(map(int, input().split())) for i in range(n))

if n == 1:
    print(-1)

elif n == 2:
    print(S(points[0], points[1])) if check(points[0], points[1]) else print(-1)

else:
    for i in range(n):
        for j in range(i + 1, n):
            if check(points[i], points[j]):
                print(S(points[i], points[j]))
                exit()

print(-1)

# Problem 59A - "Wilbur and Swimming"

n = int(raw_input())
pts = []

for i in xrange(0, n):
	r = raw_input()
	pts.append(r.split(' '))
	pts[i] = [int(x) for x in pts[i]]

if n == 1:
	print -1
elif n == 2:
	if pts[0][0] == pts[1][0] or pts[0][1] == pts[1][1]:
		print -1
	else:
		print abs((pts[0][0]-pts[1][0])*(pts[0][1]-pts[1][1]))
else:
	if pts[0][0] == pts[1][0]:
		print abs((pts[0][0]-pts[2][0])*(pts[0][1]-pts[1][1]))
	else:
		print abs((pts[0][0]-pts[1][0])*(pts[0][1]-pts[2][1]))

exit(0)

import sys
n = int(input())
arr = []
c = 0
if n == 1:
    print(-1)
    sys.exit()
for i in range(n):
    x,y = map(int,input().split())
    arr.append((x,y))
for i in range(n-1):
    if arr[i][0] != arr[i+1][0] and arr[i][1] != arr[i+1][1]:
        print(abs(arr[i][0] - arr[i+1][0]) * abs(abs(arr[i][1] - arr[i+1][1])))
        c = 1
        sys.exit()
print(-1)

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""

n = int(input())

if n == 1:
    print(-1)
elif n > 2:
    print(1)
else:
    x1, y1 = [int(i) for i in input().split()]
    x2, y2 = [int(i) for i in input().split()]

    if x1 != x2 and y1 != y2:
        print(1)
    else:
        print(-1)

n=int(raw_input())
x=[]
y=[]
for h in range(n):
    a,b=map(int,raw_input().split())
    if n==1:
        print -1
        exit()
    else:
        x.append(a)
        y.append(b)
if len(x)>2:
    if x[0]==x[1]:
        raa=x[0]-x[2]
        rbb=y[0]-y[1]
        faa=raa*rbb
        if faa==0:
            print -1
            exit()
        else:
            print abs(faa)
    elif y[0]==y[1]:
        ra=y[0]-y[2]
        rb=x[0]-x[1]
        fb=ra*rb
        if fb==0:
            print -1
            exit()
        else:
            print abs(fb)
            exit()
else:
    res=x[0]-x[1]
    res2=y[0]-y[1]
    f=res*res2
    if f==0:
        print -1
        exit()
    else:
        print abs(f)

n = int(raw_input())
pt = map(int, raw_input().split(' '))
minx = maxx = pt[0]
miny = maxy = pt[1]

if n > 1:
	for i in range(n - 1):
		pt = map(int, raw_input().split())
		if pt[0] < minx: minx = pt[0]
		if pt[0] > maxx: maxx = pt[0]
		if pt[1] < miny: miny = pt[0]
		if pt[1] > maxy: maxy = pt[0]

area = (maxx - minx) * (maxy - miny)
if area > 0:
	print area
else:
	print -1

def arr_2d(n):
    return [[int(x) for x in input().split()] for i in range(n)]

def euclidean(x1, x2, y1, y2):
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

from math import *

n = int(input())
a = sorted(arr_2d(n), key=lambda x: x[0])
if n == 1:
    print(-1)
elif n == 2 and a[0][0] == a[1][0] or a[0][1] == a[1][1]:
        print(-1)
else:
    print(abs(a[0][0] - a[-1][-1]) * abs(a[-1][0] - a[0][-1]))

n = int(input())
coords = []
for i in range(n):
    coords.append([int(i) for i in input().split()])
if n == 1:
    print(-1)
elif n == 2:
    if coords[0][0] != coords[1][0] and coords[0][1] != coords[1][1]:
        print(abs((coords[0][0]-coords[1][0]) * coords[0][1]-coords[1][1]))
    else:
        print(-1)
else:
    r = 0
    for coord1 in coords:
        for coord2 in coords:
            if coord1[0] != coord2[0] and coord1[1] != coord2[1]:
                print(abs((coord1[0]-coord2[0]) * coord1[1]-coord2[1]))
                r = 1
                break
        if r == 1:
            break

N = input()
verts = [map(int, raw_input().split()) for loop in xrange(N)]

def length(a, b):
    return ( (a[0]-b[0])**2 + (a[1]-b[1])**2 ) ** 0.5

def is_diagonal(a, b):
    if a[0]==b[0] or a[1]==b[1]:
        return False
    else:
        return True

def calc_area(N, verts):
    if N == 1:
        return -1
    elif N == 2:
        if is_diagonal(verts[0], verts[1]):
            l = length(verts[0], verts[1])
            return 0.5 * (l ** 2)
        else:
            return -1
    elif N == 3:
        if is_diagonal(verts[0], verts[1]):
            l = length(verts[0], verts[1])
        elif is_diagonal(verts[1], verts[2]):
            l = length(verts[1], vets[2])
        else:
            l = length(verts[2], vets[0])
        return 0.5 * (l ** 2)
    else:
        if is_diagonal(verts[0], verts[1]):
            l = length(verts[0], verts[1])
        elif is_diagonal(verts[0], verts[2]):
            l = length(verts[0], verts[2])
        else:
            l = length(verts[0], verts[3])
        return 0.5 * (l ** 2)

print calc_area(N, verts)

n=int(raw_input())
x=[]
y=[]
for h in range(n):
    a,b=map(int,raw_input().split())
    if n==1:
        print -1
        exit()
    else:
        x.append(a)
        y.append(b)
if len(x)>2:
    if x[0]==x[1]:
        raa=x[0]-x[2]
        rbb=y[0]-y[1]
        faa=raa*rbb
        if faa==0:
            print -1
            exit()
        else:
            print abs(faa)
    elif x[0]!=x[1]:
        rr=x[0]-x[1]
        rrr=y[0]-y[2]
        fff=rr*rrr
        print abs(fff)
    elif y[0]!=y[1]:
        gg=x[0]-x[1]
        ggg=y[0]-y[1]
        fds=gg*ggg
        print abs(fds)
    elif y[0]==y[1]:
        ra=y[0]-y[2]
        rb=x[0]-x[1]
        fb=ra*rb
        if fb==0:
            print -1
            exit()
        else:
            print abs(fb)
else:
    res=x[0]-x[1]
    res2=y[0]-y[1]
    f=res*res2
    if f==0:
        print -1
        exit()
    else:
        print abs(f)

def main():
	n = input()
	if n == 1:
		print '-1'
		return

	vertex = []
	for _ in xrange(n):
		x,y = map(int, raw_input().split())
		vertex += [(x,y)]

	l=0
	h=0
	for i in xrange(n):
		for j in xrange(i+1,n):
			if vertex[i][0] != vertex[j][0]:
				l = abs(vertex[i][0]-vertex[j][0])
			if vertex[i][1] != vertex[j][1]:
				h = abs(vertex[i][1]-vertex[j][1])
	print l*h

if __name__ == '__main__':
	main()

n=int(raw_input())
a=[]
p=0
for i in range(n):
    a.append(map(int, raw_input().split()))
for i in range(n):
    for j in range(i,n):
        if a[i][0]!=a[j][0] and a[i][1]!=a[j][1]:
            print abs(a[i][0]-a[j][0])*abs(a[i][1]-a[j][1])
            p=1
if p==0:
    print -1

n = int(raw_input())
a = []
for i in range(n):
    c = [int(x) for x in raw_input().split()]
    a.append(c)

if n==1:
    ans = -1
elif n==2:
    x1 , y1 = a[0]
    x2 , y2 = a[1]
    if x1 == x2 or y1 == y2:
        ans = -1
    else:
        ans = abs((x1 - x2)*(y1 - y2))
else :
    x1 , y1 = a[0]
    x2 , y2 = a[1]
    x3 , y3 = a[2]
    if x1 != x2:
        ans = abs((x1 - x2) * (y2 - y3))
    else:
        ans = abs((y1 - y2) * (x1 - x3))

print ans

import sys

n = int(raw_input())
if (n == 1):
  print -1
  sys.exit()

x1 = map(int, raw_input().split())
x2 = map(int, raw_input().split())
a1 = abs(x2[0]-x1[0])
a2 = abs(x2[1]-x1[1])

if (a1 != 0) and (a2 != 0):
  print a1*a2
  sys.exit()
else:
  if (n == 2):
    print -1
    sys.exit()
  else:
    x3 = map(int, raw_input().split())
    a11 = abs(x3[0]-x1[0])
    a21 = abs(x3[1]-x1[1])
    a31 = max(a1, a2)
    if (a31 == a21):
      print a31*a11
    else:
      print a31*a21

N = int(raw_input())

if N == 1:
	print -1
	exit()
A = []
B = []
for _ in range(N):
	tmp = map(int, raw_input().split())
	A.append(tmp[0])
	B.append(tmp[1])

if A[0] != A[1] and B[0] != B[1]:
	print abs(A[1] - A[0]) * abs(B[1] - B[0])
else:
	print -1

n=int(input())
x=[]
y=[]
while n>0:
    n-=1
    s=input()
    a=[int(i) for i in s.split(' ')]
    x.append(a[0])
    y.append(a[1])
kx,ky,xx,yy=0,0,-2000,-2000
dx,dy=0,0
for i in x:
    if xx!=i:
        kx+=1
        if xx!=-2000:
            dx=abs(xx-i)
        xx=i
for i in y:
    if yy!=i:
        ky+=1
        if yy!=-2000:
            dy=abs(yy-i)
        yy=i
if kx==2 and ky==2:
    SS=dx*dy
    print(SS)
else:
    print(-1)

n = int(input())
lst_x = []
lst_y = []
output = -1
for _ in range(n):
    x,y = map(int, input().split())
    if x not in lst_x and y not in lst_y:
        lst_x.append(x)
        lst_y.append(y)
    if len(lst_x) == 2:
        output = abs(lst_x[0] - lst_x[1]) * abs(lst_y[0] - lst_y[1])
print(output)

from collections import namedtuple

def get_area(vertices):
    num_vertices = len(vertices)
    Vertex = namedtuple("Vertex", ["x", "y"])
    vertices = [Vertex(*vertex) for vertex in vertices]
    if num_vertices <= 1:
        return -1

    # sort on x axis
    vertices = sorted(vertices)

    x_diff = 0
    y_diff = 0
    previous = vertices[0]
    for i in range(1, num_vertices):
        if x_diff and y_diff:
            return abs(y_diff * x_diff)
        else:
            if not x_diff and vertices[i].x != previous.x:
                x_diff = vertices[i].x - previous.x
            if not y_diff and vertices[i].y != previous.y:
                y_diff = vertices[i].y - previous.y
            previous = vertices[i]

    return abs(x_diff * y_diff)

def get_raw_input():
    num_vertices = int(raw_input())
    vertices = []
    for i in range(num_vertices):
        vertex = raw_input().split(" ")
        vertices.append((int(vertex[0]), int(vertex[1])))
    return vertices

if __name__ == "__main__":
    vertices = get_raw_input()
    print get_area(vertices)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from sys import stdin
from collections import defaultdict
from operator import itemgetter

def main():
  print("{}".format(run()))

def run():
  n = int(stdin.readline())
  if n == 1:
    return -1
  else:
    points = [list(map(int, stdin.readline().split())) for _ in range(n)]
    for p1 in points:
      for p2 in points:
        if p1 == p2:
          continue
        if p1[0] == p2[0] or p1[1] == p2[1]:
          continue
        return (p1[0] - p2[0]) * (p1[1] - p2[1])
    return -1

if __name__=="__main__":
   main()

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""

n = int(input())

if n == 1:
    print(-1)
elif n > 2:
    print(1)
else:
    x1, y1 = [int(i) for i in input().split()]
    x2, y2 = [int(i) for i in input().split()]

    if x1 != x2 and y1 != y2:
        print(1)
    else:
        print(-1)

def Respuesta(X,Y):
    X1 = list(set(X))
    Y1 = list(set(Y))
    if (len(X1)== 2 and len(Y1)==2):
        return (Y1[1]-Y1[0])*(X1[1]-X1[0])
    else:
        return -1

n = int(input())
X = []
Y = []
for i in range (0,n):
    L = input()
    L =L.split()
    X.append(int(L[0]))
    Y.append(int(L[1]))

if n==1:
    print(-1)
else:
    print(Respuesta(X,Y))

n=int(input())
l=[]
if n==0:
    print("-1")
else:
    for i in range(n):
        x,y=map(int,input().split())
        l+=[[x,y]]
if n==1 :
    print("-1")
else:
    c=0
    for i in range(n-1):
        j=i+1
        while j<n:
            if l[j][0]!=l[i][0] and l[j][1]!=l[i][1]:
                result=(l[i][0]-l[j][0])*(l[i][1]-l[j][1])
                if result >0:
                    c=1
            if c:
                print(result)
                break
            j+=1
        if c:
            break
    if not c:
        print('-1')

import sys
n = int(input())
w =[None]*n
h =[None]*n
width = height = 1
for i in range(n):
    x,y = map(int,input().split())
    w[i] = x
    h[i] = y
if(n == 1):
    print('-1')
elif(n == 2):
    if(w[0] == w[1]):
        height = abs(h[0] - h[1])
    else:
        width = abs(w[0] - w[1])
    if(h[0] == h[1]):
        width = abs(w[0] - w[1])
    else:
        height = abs(h[0] - h[1])
    print(width * height)
elif(n >= 3):
    if(w[0] != w[1]):
        width = abs(w[0] - w[1])
    elif(w[1] != w[2]):
        width = abs(w[1] - w[2])
    if(h[0] != h[1]):
        height = abs(h[0] - h[1])
    elif(h[1] != h[2]):
        height = abs(h[1] - h[2])
    print(width * height)

n = int(raw_input())
pt = map(int, raw_input().split(' '))
minx = maxx = pt[0]
miny = maxy = pt[0]

if n > 1:
	for i in range(n - 1):
		pt = map(int, raw_input().split())
		if pt[0] < minx: minx = pt[0]
		if pt[0] > maxx: maxx = pt[0]
		if pt[1] < miny: miny = pt[0]
		if pt[1] > maxy: maxy = pt[0]

area = (maxx - minx) * (maxy - miny)
if area > 0:
	print area
else:
	print -1