You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down).

More formally, if you are standing at the point $(x, y)$, you can:

go left, and move to $(x - 1, y)$, or

go right, and move to $(x + 1, y)$, or

go up, and move to $(x, y + 1)$, or

go down, and move to $(x, y - 1)$.

There are $n$ boxes on this plane. The $i$-th box has coordinates $(x_i,y_i)$. It is guaranteed that the boxes are either on the $x$-axis or the $y$-axis. That is, either $x_i=0$ or $y_i=0$.

You can collect a box if you and the box are at the same point. Find the minimum number of moves you have to perform to collect all of these boxes if you have to start and finish at the point $(0,0)$.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \le n \le 100$) — the number of boxes.

The $i$-th line of the following $n$ lines contains two integers $x_i$ and $y_i$ ($-100 \le x_i, y_i \le 100$) — the coordinate of the $i$-th box. It is guaranteed that either $x_i=0$ or $y_i=0$.

Do note that the sum of $n$ over all test cases is not bounded.


-----Output-----

For each test case output a single integer — the minimum number of moves required.


-----Examples-----

Input
3
4
0 -2
1 0
-1 0
0 2
3
0 2
-3 0
0 -1
1
0 0
Output
12
12
0


-----Note-----

In the first test case, a possible sequence of moves that uses the minimum number of moves required is shown below.

$$(0,0) \to (1,0) \to (1,1) \to (1, 2) \to (0,2) \to (-1,2) \to (-1,1) \to (-1,0) \to (-1,-1) \to (-1,-2) \to (0,-2) \to (0,-1) \to (0,0)$$

In the second test case, a possible sequence of moves that uses the minimum number of moves required is shown below.

$$(0,0) \to (0,1) \to (0,2) \to (-1, 2) \to (-2,2) \to (-3,2) \to (-3,1) \to (-3,0) \to (-3,-1) \to (-2,-1) \to (-1,-1) \to (0,-1) \to (0,0)$$

In the third test case, we can collect all boxes without making any moves.

Difficulty: EASY
Tags: Geometry

Implementation

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	Sum = 0
	(A1, A2, A3, A4) = ([], [], [], [])
	for _ in range(n):
		(a, b) = map(int, input().split())
		if a > 0:
			A1.append(a)
		elif a < 0:
			A2.append(-a)
		elif b > 0:
			A3.append(b)
		elif b < 0:
			A4.append(-b)
	if A1:
		Sum += max(A1) * 2
	if A2:
		Sum += max(A2) * 2
	if A3:
		Sum += max(A3) * 2
	if A4:
		Sum += max(A4) * 2
	print(Sum)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	v1 = v2 = v3 = v4 = 0
	for _ in range(n):
		(x, y) = map(int, input().split())
		v1 = max(x, v1)
		v2 = min(x, v2)
		v3 = max(y, v3)
		v4 = min(y, v4)
	return 2 * (v1 - v2 + v3 - v4)
for _ in range(int(input())):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	nx = []
	px = []
	ny = []
	py = []
	for i in range(n):
		(x, y) = map(int, input().split())
		if x == 0:
			if y < 0:
				ny.append(y)
			else:
				py.append(y)
		if y == 0:
			if x < 0:
				nx.append(x)
			else:
				px.append(x)
	if len(ny) != 0:
		a = abs(min(ny))
	else:
		a = 0
	if len(py) != 0:
		b = max(py)
	else:
		b = 0
	if len(nx) != 0:
		c = abs(min(nx))
	else:
		c = 0
	if len(px) != 0:
		d = max(px)
	else:
		d = 0
	print(2 * (a + b + c + d))


for _ in range(int(input())):
	n = int(input())
	xpos = []
	xneg = []
	ypos = []
	yneg = []
	for j in range(n):
		(x, y) = map(int, input().split())
		if x == 0:
			if y < 0:
				yneg.append(y)
			else:
				ypos.append(y)
		elif x < 0:
			xneg.append(x)
		else:
			xpos.append(x)
	total = 0
	if len(xpos) > 0:
		total += abs(max(xpos)) * 2
	if len(xneg) > 0:
		total += abs(min(xneg)) * 2
	if len(ypos) > 0:
		total += abs(max(ypos)) * 2
	if len(yneg) > 0:
		total += abs(min(yneg)) * 2
	print(total)


from sys import setrecursionlimit, stdin
setrecursionlimit(1 << 20)
readline = stdin.readline
MOD = 998244353

def I():
	return int(readline())

def ST():
	return readline()[:-1]

def LI():
	return list(map(int, readline().split()))

def LII():
	return list(map(lambda x: int(x) - 1, readline().split()))

def LF(x, func):
	return [func() for _ in [0] * x]

def SPI():
	return map(int, readline().split())

def SPII():
	return map(lambda x: int(x) - 1, readline().split())

def FIE(x):
	return [readline()[:-1] for _ in [0] * x]
INF = 10 ** 18

def solve():
	N = I()
	X = [0, 0]
	Y = [0, 0]
	for _ in range(N):
		(x, y) = SPI()
		X[0] = min(X[0], x)
		X[1] = max(X[1], x)
		Y[0] = min(Y[0], y)
		Y[1] = max(Y[1], y)
	ans = (X[1] - X[0] + Y[1] - Y[0]) * 2
	print(ans)
t = I()
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	left = right = top = bottom = 0
	for _ in range(n):
		(x, y) = map(int, input().split())
		if x < 0:
			left = max(left, abs(x))
		if x > 0:
			right = max(right, x)
		if y < 0:
			bottom = max(bottom, abs(y))
		if y > 0:
			top = max(top, y)
	print(2 * (top + bottom + right + left))


for _ in range(int(input())):
	n = int(input())
	x_max = x_min = y_max = y_min = 0
	for i in range(n):
		(x, y) = (int(x) for x in input().split())
		if x > x_max:
			x_max = x
		if x < x_min:
			x_min = x
		if y > y_max:
			y_max = y
		if y < y_min:
			y_min = y
	y_min = -y_min
	x_min = -x_min
	print((x_max + x_min + y_max + y_min) * 2)


for _ in range(int(input())):
	n = int(input())
	x_pos = [0]
	y_pos = [0]
	x_neg = [0]
	y_neg = [0]
	for i in range(n):
		(a, b) = map(int, input().split())
		if a:
			if a > 0:
				x_pos.append(a)
			else:
				x_neg.append(abs(a))
		elif b:
			if b > 0:
				y_pos.append(b)
			else:
				y_neg.append(abs(b))
	print(max(x_pos) * 2 + max(y_pos) * 2 + max(x_neg) * 2 + max(y_neg) * 2)


T = int(input())
while T:
	n = int(input())
	(x, y) = ([], [])
	for i in range(n):
		(a, b) = map(int, input().split())
		x.append(a)
		y.append(b)
	ans = 0
	if max(x) > 0 and min(x) > 0:
		ans += 2 * max(x)
	elif max(x) < 0 and min(x) < 0:
		ans += 2 * (-1 * min(x))
	else:
		ans += 2 * (max(x) - min(x))
	if max(y) > 0 and min(y) > 0:
		ans += 2 * max(y)
	elif max(y) < 0 and min(y) < 0:
		ans += 2 * (-1 * min(y))
	else:
		ans += 2 * (max(y) - min(y))
	print(ans)
	T = T - 1


t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	par = []
	par2 = []
	for j in range(n):
		(a, b) = map(int, input().split())
		if a == 0:
			par.append(b)
		else:
			par2.append(a)
	par.append(0)
	par2.append(0)
	par.sort()
	par2.sort()
	if par[0] >= 0:
		p1 = par[len(par) - 1] * 2
	else:
		p1 = (par[len(par) - 1] + abs(par[0])) * 2
	if par2[0] >= 0:
		p2 = par2[len(par2) - 1] * 2
	else:
		p2 = (par2[len(par2) - 1] + abs(par2[0])) * 2
	print(p1 + p2)


for _ in range(int(input())):
	xa = [0]
	ya = [0]
	ans = 0
	for __ in range(int(input())):
		(x, y) = input().split()
		if x == '0':
			ya.append(int(y))
		else:
			xa.append(int(x))
	if min(ya) < 0:
		ans += abs(min(ya))
	if min(xa) < 0:
		ans += abs(min(xa))
	if max(ya) > 0:
		ans += max(ya)
	if max(xa) > 0:
		ans += max(xa)
	print(ans * 2)


for _ in range(int(input())):
	n = int(input())
	x = [0]
	y = [0]
	for _ in range(n):
		(a, b) = map(int, input().split())
		x.append(a)
		y.append(b)
	print((max(x) - min(x) + max(y) - min(y)) * 2)


for _ in range(int(input())):
	a = int(input())
	xl = 0
	yl = 0
	xm = 0
	ym = 0
	for i in range(a):
		(x, y) = map(int, input().split())
		if xl > x:
			xl = x
		if xm < x:
			xm = x
		if yl > y:
			yl = y
		if ym < y:
			ym = y
	print(abs((xm - xl) * 2) + abs((ym - yl) * 2))


t = int(input())
for i in range(t):
	n = int(input())
	lst = [0, 0, 0, 0]
	for j in range(n):
		(x, y) = [int(x) for x in input().split(' ')]
		if x < 0:
			lst[0] = max(lst[0], abs(x))
		elif x > 0:
			lst[1] = max(lst[1], x)
		elif y < 0:
			lst[2] = max(lst[2], abs(y))
		elif y > 0:
			lst[3] = max(lst[3], y)
	print(sum(lst) * 2)
	print('\n')


for i in range(int(input())):
	n = int(input())
	ans = 0
	max_x_positive = 0
	max_x_negative = 0
	max_y_positive = 0
	max_y_negative = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x > 0 and x >= max_x_positive:
			max_x_positive = x
		elif x < 0 and x < max_x_negative:
			max_x_negative = x
		elif y >= 0 and y >= max_y_positive:
			max_y_positive = y
		elif y < 0 and y < max_y_negative:
			max_y_negative = y
	ans = 2 * abs(max_y_negative) + 2 * abs(max_y_positive) + 2 * abs(max_x_negative) + 2 * abs(max_x_positive)
	print(ans)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(input())
	maxr = 0
	maxl = 0
	maxu = 0
	maxd = 0
	for j in range(n):
		(x, y) = map(int, input().split())
		if y == 0:
			if x > 0:
				maxr = max(maxr, x)
			else:
				maxl = max(maxl, abs(x))
		elif y > 0:
			maxu = max(maxu, y)
		else:
			maxd = max(maxd, abs(y))
	print(2 * maxr + 2 * maxl + 2 * maxu + 2 * maxd)


t = int(input())
for i in range(t):
	n = int(input())
	maxX = 0
	minX = 0
	maxY = 0
	minY = 0
	while n != 0:
		(x, y) = map(int, input().split())
		maxX = max(x, maxX)
		minX = min(x, minX)
		maxY = max(y, maxY)
		minY = min(y, minY)
		n -= 1
	move = 2 * (maxX + maxY - minX - minY)
	print(move)


for _ in range(int(input())):
	x1 = [0]
	y1 = [0]
	for _ in range(int(input())):
		(x, y) = map(int, input().split())
		x1.append(x)
		y1.append(y)
	print((max(x1) - min(x1) + max(y1) - min(y1)) * 2)


for _ in range(int(input())):
	n = int(input())
	count = 0
	pym = 0
	nym = 0
	pxm = 0
	nxm = 0
	for x in range(n):
		point = [int(x) for x in input().split()]
		if point[0] == 0 and point[1] > pym and (point[1] > 0):
			pym = point[1]
		elif point[0] == 0 and abs(point[1]) > nym and (point[1] < 0):
			nym = abs(point[1])
		elif point[1] == 0 and point[0] > pxm and (point[0] > 0):
			pxm = point[0]
		elif point[1] == 0 and abs(point[0]) > nxm and (point[0] < 0):
			nxm = abs(point[0])
	print(2 * (nxm + nym + pxm + pym))


a = int(input())
for i in range(a):
	s = int(input())
	x1 = [0]
	y1 = [0]
	x2 = [0]
	y2 = [0]
	for i in range(s):
		(p, q) = map(int, input().split())
		if p == 0:
			if q > 0:
				x1.append(q)
			else:
				x2.append(q)
		elif p > 0:
			y1.append(p)
		else:
			y2.append(p)
	x1.sort()
	x2.sort()
	y1.sort()
	y2.sort()
	total = max(x1) + abs(min(x2)) + max(y1) + abs(min(y2))
	print(2 * total)


def maxi(lst):
	if lst == []:
		return 0
	else:
		return max(lst)
t = int(input())
for i in range(0, t):
	n = int(input())
	lxp = []
	lxn = []
	lyp = []
	lyn = []
	for j in range(0, n):
		l = input().split()
		l[0] = int(l[0])
		if l[0] > 0:
			lxp.append(l[0])
		elif l[0] < 0:
			lxn.append(-l[0])
		l[1] = int(l[1])
		if l[1] > 0:
			lyp.append(l[1])
		elif l[1] < 0:
			lyn.append(-l[1])
	print(2 * (maxi(lxp) + maxi(lxn) + maxi(lyp) + maxi(lyn)))


def solve():
	n = int(input())
	(xp, xn, yp, yn) = (0, 0, 0, 0)
	for __ in range(n):
		(x, y) = map(int, input().split())
		if x == 0:
			if y >= 0:
				yp = max(yp, y)
			else:
				yn = min(yn, y)
		elif x >= 0:
			xp = max(xp, x)
		else:
			xn = min(xn, x)
	print((xp + yp + abs(xn) + abs(yn)) * 2)
for _ in range(int(input())):
	solve()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	farthest = [0, 0, 0, 0]
	n = int(input())
	for _ in range(n):
		(x, y) = [int(i) for i in input().split()]
		if x == 0 and y == 0:
			continue
		elif x == 0 and y > 0:
			farthest[0] = max(farthest[0], y)
		elif x == 0 and y < 0:
			farthest[1] = max(farthest[1], -y)
		elif x > 0 and y == 0:
			farthest[2] = max(farthest[2], x)
		elif x < 0 and y == 0:
			farthest[3] = max(farthest[3], -x)
	print(sum(farthest) * 2)


t = int(input())
for _ in range(t):
	n = int(input())
	maxx = 0
	minx = 0
	maxy = 0
	miny = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if a > maxx:
			maxx = a
		elif a < minx:
			minx = a
		if b > maxy:
			maxy = b
		elif b < miny:
			miny = b
	print(2 * (abs(minx) + abs(miny) + maxx + maxy))


def max_L(L):
	if L == []:
		return 0
	else:
		return max(L)

def min_L(L):
	if L == []:
		return 0
	else:
		return min(L)
t = int(input())
for i in range(t):
	n = int(input())
	xp = []
	xn = []
	yp = []
	yn = []
	for i in range(n):
		c = input().split()
		cx = int(c[0])
		cy = int(c[1])
		if cx > 0:
			xp.append(cx)
		if cx <= 0:
			xn.append(cx)
		if cy > 0:
			yp.append(cy)
		if cy <= 0:
			yn.append(cy)
	ans = 2 * (max_L(xp) + max_L(yp) + abs(min_L(yn)) + abs(min_L(xn)))
	print(ans)


def solve():
	n = int(input())
	left = right = up = down = 0
	while n:
		(x, y) = getInt()
		if x > 0:
			right = max(right, x)
		elif x < 0:
			left = max(left, abs(x))
		elif y > 0:
			up = max(up, y)
		else:
			down = max(down, abs(y))
		n = n - 1
	print((left + right + up + down) * 2)

def getInt():
	return list(map(int, input().split()))
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(x_p, x_m, y_p, y_m) = (0, 0, 0, 0)
	for _ in range(int(input())):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		if y == 0:
			if not x > x_p:
				if x < x_m:
					x_m = x
			else:
				x_p = x
		elif not y > y_p:
			if y < y_m:
				y_m = y
		else:
			y_p = y
	print(2 * y_p + 2 * x_p + 2 * abs(y_m) + 2 * abs(x_m))


times = int(input())
for i in range(times):
	boxes = int(input())
	x = [0] * boxes
	y = [0] * boxes
	for j in range(boxes):
		(x[j], y[j]) = map(int, input().split())
	xmax = max(x) if max(x) >= 0 else 0
	xmin = abs(min(x)) if min(x) <= 0 else 0
	ymax = max(y) if max(y) >= 0 else 0
	ymin = abs(min(y)) if min(y) <= 0 else 0
	print(2 * (xmax + ymax + xmin + ymin))


testy = int(input())
for _ in range(testy):
	n = int(input())
	lewo = 0
	prawo = 0
	gora = 0
	dol = 0
	for i in range(n):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		if a < 0:
			lewo = max(lewo, 0 - a)
		elif a > 0:
			prawo = max(prawo, a)
		elif b < 0:
			dol = max(dol, 0 - b)
		elif b > 0:
			gora = max(gora, b)
	print(2 * (lewo + prawo + dol + gora))


t = int(input())
for test in range(t):
	n = int(input())
	[xp, xn, yp, yn] = [0, 0, 0, 0]
	for i in range(n):
		[x, y] = [int(_) for _ in input().split()]
		if x == 0:
			if yp < y:
				yp = y
			if yn > y:
				yn = y
		if y == 0:
			if xp < x:
				xp = x
			if xn > x:
				xn = x
		res = yp + xp
	if yn <= 0:
		res -= yn
	if xn <= 0:
		res -= xn
	print(2 * res)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	(min_x, min_y, max_x, max_y) = (0, 0, 0, 0)
	for _ in range(inp()):
		(x, y) = inlt()
		if x < min_x:
			min_x = x
		if y < min_y:
			min_y = y
		if x > max_x:
			max_x = x
		if y > max_y:
			max_y = y
	ans = (max_x - min_x + max_y - min_y) * 2
	print(ans)


t = int(input())
ans = [0] * t
for i in range(t):
	n = int(input())
	(x_pos, x_neg, y_pos, y_neg) = (0, 0, 0, 0)
	for j in range(n):
		(x, y) = map(int, input().split())
		if x > x_pos:
			x_pos = x
		elif x_neg > x:
			x_neg = x
		elif y > y_pos:
			y_pos = y
		elif y < y_neg:
			y_neg = y
	ans[i] = 2 * (-x_neg + x_pos + -y_neg + y_pos)
for i in range(t):
	print(ans[i])


for tc in range(int(input())):
	n = int(input())
	lx = [0]
	ly = [0]
	for i in range(n):
		(x, y) = map(int, input().split())
		lx.append(x)
		ly.append(y)
	print(2 * max(lx) + 2 * max(ly) - 2 * min(lx) - 2 * min(ly))


t = int(input())
for _ in range(t):
	n = int(input())
	(xp, xn, yp, yn) = (0, 0, 0, 0)
	for i in range(n):
		(x, y) = map(int, input().split())
		if y == 0:
			if x > 0:
				xp = max(xp, x)
			else:
				xn = min(xn, x)
		elif y > 0:
			yp = max(yp, y)
		else:
			yn = min(yn, y)
	print(2 * (abs(xp) + abs(yp) + abs(xn) + abs(yn)))


for _ in range(int(input())):
	n = int(input())
	Nb = 0
	X = [0]
	Y = [0]
	for i in range(n):
		T = list(map(int, input().split(' ')))
		X.append(T[0])
		Y.append(T[1])
	print((max(X) - min(X) + max(Y) - min(Y)) * 2)


t = int(input())
for i in range(t):
	n = int(input())
	l1 = []
	l2 = []
	l3 = []
	l4 = []
	for i in range(n):
		(a, b) = map(int, input().split())
		if a > 0:
			l1.append(a)
		if b > 0:
			l2.append(b)
		if a < 0:
			l3.append(a)
		if b < 0:
			l4.append(b)
	if l1 == []:
		a1 = 0
	else:
		a1 = max(l1)
	if l2 == []:
		a2 = 0
	else:
		a2 = max(l2)
	if l3 == []:
		a3 = 0
	else:
		a3 = min(l3)
	if l4 == []:
		a4 = 0
	else:
		a4 = min(l4)
	print(2 * (a1 + a2 + -1 * a3 + -1 * a4))


from math import floor
t = int(input())
for _ in range(t):
	n = int(input())
	coords = []
	px = 0
	py = 0
	nx = 0
	ny = 0
	for p in range(n):
		(x, y) = map(int, input().split())
		if x > px:
			px = x
		elif x < nx:
			nx = x
		if y > py:
			py = y
		elif y < ny:
			ny = y
	print((px + py + abs(nx) + abs(ny)) * 2)


for _ in range(int(input())):
	x = list()
	y = list()
	for _ in range(int(input())):
		(x1, y1) = map(int, input().split())
		x.append(x1)
		y.append(y1)
	x_max = max(x)
	x_min = min(x)
	y_max = max(y)
	y_min = min(y)
	len_x = 0
	if x_max < 0:
		len_x = x_min * -2
	elif x_min > 0:
		len_x = x_max * 2
	else:
		len_x = 2 * (x_max - x_min)
	len_y = 0
	if y_max < 0:
		len_y = y_min * -2
	elif y_min > 0:
		len_y = y_max * 2
	else:
		len_y = 2 * (y_max - y_min)
	print(len_x + len_y)


import sys

def solve():
	for i in range(int(input())):
		a = [0, 0, 0, 0]
		for i in range(int(input())):
			s = list(map(int, input().split()))
			m = sum(s)
			if s[0]:
				if m > a[0]:
					a[0] = m
				elif m < a[1]:
					a[1] = m
			elif m > a[2]:
				a[2] = m
			elif m < a[3]:
				a[3] = m
		print((a[0] - a[1] + a[2] - a[3]) * 2)

def main():
	solve()
main()


for rep in range(int(input())):
	num = int(input())
	a = [0]
	b = [0]
	for rep in range(num):
		(a1, b1) = map(int, input().split())
		a.append(a1)
		b.append(b1)
	print((max(a) - min(a) + max(b) - min(b)) * 2)


T = int(input())
for i in range(T):
	n = int(input())
	ans = 0
	maxx = 0
	maxy = 0
	minx = 0
	miny = 0
	for i in range(n):
		(x, y) = input().split()
		x = int(x)
		y = int(y)
		if x < minx:
			minx = x
		if x > maxx:
			maxx = x
		if y > maxy:
			maxy = y
		if y < miny:
			miny = y
	if maxx * minx < 0:
		ans = ans + maxx - minx
	elif maxx < 0:
		ans = ans - maxx + minx
	else:
		ans = ans + maxx - minx
	if maxy * miny < 0:
		ans = ans + maxy - miny
	elif maxy < 0:
		ans = ans - maxy + miny
	else:
		ans = ans + maxy - miny
	print(2 * ans)


t = int(input())
for _ in range(t):
	n = int(input())
	max_x_y = [0, 0]
	min_x_y = [0, 0]
	for i in range(n):
		(x, y) = map(int, input().split())
		if x < 0:
			if x < min_x_y[0]:
				min_x_y[0] = x
		elif x > max_x_y[0]:
			max_x_y[0] = x
		if y < 0:
			if y < min_x_y[1]:
				min_x_y[1] = y
		elif y > max_x_y[1]:
			max_x_y[1] = y
	print((sum(max_x_y) + abs(sum(min_x_y))) * 2)


for _ in range(int(input())):
	l1 = []
	l2 = []
	result = 0
	for i in range(int(input())):
		x = input().split()
		if x[0] == '0':
			l1.append(int(x[1]))
		if x[1] == '0':
			l2.append(int(x[0]))
	try:
		mx1 = max(l1)
	except:
		pass
	try:
		mn1 = min(l1)
	except:
		pass
	if len(l1) != 0 and mx1 * mn1 <= 0:
		result = 2 * (mx1 - mn1)
	if len(l1) != 0 and mx1 * mn1 > 0:
		result = 2 * max(mx1, abs(mn1))
	try:
		mx1 = max(l2)
	except:
		pass
	try:
		mn1 = min(l2)
	except:
		pass
	if len(l2) != 0 and mx1 * mn1 <= 0:
		result += 2 * (mx1 - mn1)
	if len(l2) != 0 and mx1 * mn1 > 0:
		result += 2 * max(mx1, abs(mn1))
	print(result)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	max_x = 0
	min_x = 0
	max_y = 0
	min_y = 0
	while n > 0:
		n -= 1
		(x, y) = (int(k) for k in input().split())
		if x > 0 and max_x < x:
			max_x = x
		if x < 0 and min_x > x:
			min_x = x
		if y > 0 and max_y < y:
			max_y = y
		if y < 0 and min_y > y:
			min_y = y
	print(2 * (max_x - min_x + max_y - min_y))


tt = int(input())
for _ in range(tt):
	xx = []
	yy = []
	n = int(input())
	for i in range(n):
		(x, y) = map(int, input().split())
		if x != 0:
			xx.append(x)
		else:
			yy.append(y)
	xx.sort()
	yy.sort()
	ans = 0
	if len(xx) > 0:
		if xx[0] < 0:
			ans += abs(xx[0])
		if xx[-1] > 0:
			ans += xx[-1]
	if len(yy) > 0:
		if yy[0] < 0:
			ans += abs(yy[0])
		if yy[-1] > 0:
			ans += yy[-1]
	print(ans * 2)


def eff(l):
	if l[0] >= 0:
		return l[-1]
	elif l[-1] < 0:
		return -l[0]
	elif l[0] <= 0 and l[-1] >= 0:
		return l[-1] - l[0]
t = int(input())
for i in range(0, t):
	x = []
	y = []
	n = int(input())
	ans = 0
	for i1 in range(0, n):
		(cx, cy) = input().split()
		if int(cx) == 0:
			y.append(int(cy))
		else:
			x.append(int(cx))
	x = sorted(x)
	y = sorted(y)
	if len(x) == 0:
		print(2 * eff(y))
	elif len(y) == 0:
		print(2 * eff(x))
	else:
		print(2 * eff(x) + 2 * eff(y))


from math import sqrt
test_num = int(input())
for i in range(test_num):
	n = int(input())
	nodes = [[0], [0], [0], [0]]
	for j in range(n):
		(x, y) = map(int, input().split())
		if x > 0:
			nodes[0].append(x)
		elif x < 0:
			nodes[1].append(x)
		elif y > 0:
			nodes[2].append(y)
		elif y < 0:
			nodes[3].append(y)
	result = 0
	result += abs(2 * max(nodes[0]))
	result += abs(2 * min(nodes[1]))
	result += abs(2 * max(nodes[2]))
	result += abs(2 * min(nodes[3]))
	print(result)


case = int(input())
for i in range(case):
	n = int(input())
	xx = [0]
	yy = [0]
	for t in range(n):
		(x, y) = map(int, input().split())
		xx.append(x)
		yy.append(y)
	xx.sort()
	yy.sort()
	print(2 * (xx[-1] + yy[-1] - xx[0] - yy[0]))


import sys
input = lambda : sys.stdin.readline().rstrip()

def solve():
	n = int(input())
	a = [list(map(int, input().split())) for __ in range(n)]
	a.sort()
	ans = 0
	ans += abs(a[0][0]) + abs(a[0][1])
	for i in range(n - 1):
		diff = abs(a[i][0] - a[i + 1][0]) + abs(a[i][1] - a[i + 1][1])
		ans += diff
	ans += abs(a[-1][0]) + abs(a[-1][1])
	print(ans)
for __ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	(max1, max2, may1, may2) = (0, 0, 0, 0)
	for i in range(n):
		(x, y) = map(int, input().split())
		if x > max1:
			max1 = x
		elif x < max2:
			max2 = x
		elif y > may1:
			may1 = y
		elif y < may2:
			may2 = y
	print((max1 + abs(max2) + may1 + abs(may2)) * 2)


def main():
	for _ in range(int(input())):
		problem()

def problem():
	n = int(input())
	leftmost = 0
	rightmost = 0
	topmost = 0
	bottommost = 0
	for _ in range(n):
		(x, y) = map(int, input().split())
		if x == 0:
			if y > 0:
				topmost = max(topmost, y)
			else:
				bottommost = max(bottommost, -y)
		elif x > 0:
			rightmost = max(rightmost, x)
		else:
			leftmost = max(leftmost, -x)
	total = 2 * (leftmost + rightmost + topmost + bottommost)
	print(total)
import sys
input = sys.stdin.readline
sys.exit(main())


def solve():
	n = int(input())
	a = b = c = d = 0
	for _ in range(n):
		(x, y) = map(int, input().split())
		if x == 0 and y < 0:
			a = max(a, abs(y))
		elif x == 0 and y >= 0:
			b = max(b, y)
		elif y == 0 and x < 0:
			c = max(c, abs(x))
		elif y == 0 and x >= 0:
			d = max(d, x)
	print((a + b + c + d) * 2)
for _ in range(int(input())):
	solve()


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

def inp_s(k):
	arr = []
	for i in range(k):
		arr.append(input())
	return arr

def help():
	pass
for _ in range(int(input())):
	n = int(input())
	boxes = []
	for i in range(n):
		(x, y) = inp_a()
		boxes.append([x, y])
	ans = 0
	(px, nx, py, ny) = (0, 0, 0, 0)
	for (x, y) in boxes:
		if x == 0:
			if y > 0:
				py = max(py, y)
			else:
				ny = max(ny, -y)
		elif x > 0:
			px = max(px, x)
		else:
			nx = max(nx, -x)
	print(2 * (px + py + nx + ny))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	mix = 0
	mx = 0
	miy = 0
	my = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		mix = min(mix, x)
		mx = max(mx, x)
		miy = min(miy, y)
		my = max(my, y)
	print((abs(mix) + abs(miy) + my + mx) * 2)


t = int(input())
for _ in range(t):
	n = int(input())
	max_distance = [0] * 4
	for __ in range(n):
		(xi, yi) = input().split()
		(xi, yi) = (int(xi), int(yi))
		if xi == 0:
			if yi >= 0:
				idx = 2
			else:
				idx = 3
		elif xi >= 0:
			idx = 0
		else:
			idx = 1
		max_distance[idx] = max(max_distance[idx], abs(xi) + abs(yi))
	print(2 * sum(max_distance))


out = []
for _ in range(int(input())):
	n = int(input())
	mina = maxa = minb = maxb = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x != 0:
			mina = min(mina, x)
			maxa = max(maxa, x)
		else:
			minb = min(minb, y)
			maxb = max(maxb, y)
	out.append((maxa - mina + maxb - minb) * 2)
for i in out:
	print(i)


for _ in range(int(input())):
	n = int(input())
	_x = 0
	_y = 0
	x = 0
	y = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if a == 0:
			if b > 0:
				y = max(y, b)
			else:
				_y = min(_y, b)
		elif b == 0:
			if a > 0:
				x = max(a, x)
			else:
				_x = min(a, _x)
	print(2 * (abs(_x) + abs(_y) + x + y))


for _ in range(int(input())):
	n = int(input())
	ans = 0
	x1 = 0
	x2 = 0
	y1 = 0
	y2 = 0
	for _ in range(n):
		(x, y) = map(int, input().split())
		if x > 0:
			x1 = max(x1, x)
		if x < 0:
			x2 = max(x2, abs(x))
		if y > 0:
			y1 = max(y1, y)
		if y < 0:
			y2 = max(y2, abs(y))
	ans = (x1 + x2 + y1 + y2) * 2
	print(ans)


t = int(input())
for T in range(t):
	n = int(input())
	(l, r, u, d) = (0, 0, 0, 0)
	for i in range(n):
		(x, y) = map(int, input().split())
		if x == 0:
			if y >= 0:
				u = max(u, y)
			else:
				d = max(d, abs(y))
		elif x >= 0:
			r = max(r, x)
		else:
			l = max(l, abs(x))
	print(2 * (l + r + u + d))


t = int(input())
for _ in range(t):
	n = int(input())
	(u, d, l, r) = (0, 0, 0, 0)
	for i in range(n):
		(x, y) = map(int, input().split())
		if x > r:
			r = x
		elif y > u:
			u = y
		elif x < l:
			l = x
		elif y < d:
			d = y
	print(2 * (u + r + abs(d) + abs(l)))


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	max_px = 0
	max_nx = 0
	max_py = 0
	max_ny = 0
	for i in range(n):
		(x, y) = [int(j) for j in input().split()]
		if y == 0:
			if x > 0:
				if x > max_px:
					max_px = x
			elif abs(x) > max_nx:
				max_nx = abs(x)
		elif x == 0:
			if y > 0:
				if y > max_py:
					max_py = y
			elif abs(y) > max_ny:
				max_ny = abs(y)
	print(2 * (max_nx + max_ny + max_px + max_py))


for _ in range(int(input())):
	y = [0]
	n = int(input())
	x = [0]
	if 45834574 == 'ffojgirj':
		print('Tanmay')
	for i in range(n):
		a = [int(x) for x in input().split()]
		if a[0] == 0:
			y.append(a[1])
		else:
			x.append(a[0])
	xp = abs(max(x))
	xn = abs(min(x))
	yp = abs(max(y))
	yn = abs(min(y))
	print((xp + xn + yp + yn) * 2)


for _ in range(int(input())):
	n = int(input())
	x = []
	y = []
	for i in range(n):
		(a, b) = map(int, input().split())
		x.append(a)
		y.append(b)
	ans = 0
	maxX = minX = maxY = minY = 0
	if max(x) > 0:
		maxX = max(x)
	if min(x) < 0:
		minX = min(x)
	if max(y) > 0:
		maxY = max(y)
	if min(y) < 0:
		minY = min(y)
	ans += maxX
	ans += maxY + maxX
	ans += abs(minX) + maxY
	ans += abs(minY) + abs(minX)
	ans += abs(minY)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = 0
	b = 0
	c = 0
	d = 0
	for p in range(n):
		l = list(map(int, input().split()))
		if l[0] == 0:
			if l[1] > 0:
				a = max(a, l[1])
			elif l[1] < 0:
				b = min(b, l[1])
		elif l[1] == 0:
			if l[0] < 0:
				c = min(c, l[0])
			elif l[0] > 0:
				d = max(d, l[0])
	res = max(a, -a) + max(b, -b) + max(c, -c) + max(d, -d)
	print(2 * res)


for _ in range(int(input())):
	n = int(input())
	ans = 0
	xp = 0
	xn = 0
	yp = 0
	yn = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x < 0 and abs(x) > xn:
			xn = abs(x)
		if x > 0 and x > xp:
			xp = x
		if y < 0 and abs(y) > yn:
			yn = abs(y)
		if y > 0 and y > yp:
			yp = y
	ans = 2 * (xp + xn + yp + yn)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	li = []
	cnt = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		li.append([x, y])
	li.sort()
	li.append([0, 0])
	prevX = 0
	prevY = 0
	for i in range(n + 1):
		cnt += abs(prevX - li[i][0])
		cnt += abs(prevY - li[i][1])
		prevX = li[i][0]
		prevY = li[i][1]
	print(cnt)


t = int(input())
for _ in range(t):
	n = int(input())
	left = 0
	right = 0
	up = 0
	down = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		if x == 0 and y > 0:
			if y > up:
				up = y
		elif x == 0 and y < 0:
			if y < down:
				down = y
		elif y == 0 and x > 0:
			if x > right:
				right = x
		elif y == 0 and x < 0:
			if x < left:
				left = x
		dist = (up + right + abs(left) + abs(down)) * 2
	print(dist)


I = input
for _ in [0] * int(I()):
	a = (b, c) = ([0, 0], [0, 0])
	for _ in [0] * int(I()):
		for (l, y) in zip(a, map(int, I().split())):
			l[y < 0] = max(l[y < 0], abs(y))
	print(2 * sum(b + c))


for _ in range(int(input())):
	n = int(input())
	l1 = [0]
	l2 = [0]
	for i in range(n):
		(a, b) = map(int, input().split())
		l1.append(a)
		l2.append(b)
	l1.sort()
	l2.sort()
	c1 = abs(l1[-1] - l1[0])
	c2 = abs(l2[-1] - l2[0])
	d = 2 * (c1 + c2)
	print(d)


test = int(input())
while test:
	n = int(input())
	topmost = rightmost = 0
	leftmost = bottommost = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		topmost = max(topmost, y)
		rightmost = max(rightmost, x)
		leftmost = min(leftmost, x)
		bottommost = min(bottommost, y)
	print(2 * (topmost + rightmost - (leftmost + bottommost)))
	test -= 1


t = int(input())
for test_cases in range(t):
	n = int(input())
	xmax = 0
	xmin = 0
	ymax = 0
	ymin = 0
	for points in range(n):
		point = list(map(int, input().split()))
		if point[0] > xmax:
			xmax = point[0]
		elif point[0] < xmin:
			xmin = point[0]
		if point[1] > ymax:
			ymax = point[1]
		elif point[1] < ymin:
			ymin = point[1]
	print(2 * (xmax - xmin + ymax - ymin))


def solve():
	minx = miny = maxx = maxy = 0
	for i in range(int(input())):
		(x, y) = map(int, input().split())
		minx = min(minx, x)
		miny = min(miny, y)
		maxx = max(maxx, x)
		maxy = max(maxy, y)
	print(2 * (maxx + maxy - miny - minx))
a = int(input())
for _ in range(a):
	solve()


n = int(input())
for i in range(n):
	k = int(input())
	x_list_p = [0]
	y_list_p = [0]
	x_list_n = [0]
	y_list_n = [0]
	for i in range(k):
		a = list(map(int, input().split()))
		if a[0] == 0 and a[1] > 0:
			y_list_p.append(a[1])
		elif a[0] > 0 and a[1] == 0:
			x_list_p.append(a[0])
		elif a[0] == 0 and a[1] < 0:
			y_list_n.append(abs(a[1]))
		elif a[0] < 0 and a[1] == 0:
			x_list_n.append(abs(a[0]))
	print(2 * (max(x_list_p) + max(y_list_p) + max(x_list_n) + max(y_list_n)))


num_inp = lambda : int(input())
arr_inp = lambda : list(map(int, input().split()))
sp_inp = lambda : map(int, input().split())
str_inp = lambda : input()
t = num_inp()
for _ in range(t):
	n = num_inp()
	p1 = {1: [0], 2: [0], 3: [0], 4: [0]}
	for i in range(n):
		(x, y) = sp_inp()
		if x == 0:
			if y >= 0:
				p1[2].append(y)
			else:
				p1[4].append(-y)
		elif x >= 0:
			p1[1].append(x)
		else:
			p1[3].append(-x)
	l = [max(p1[1]), max(p1[2]), max(p1[3]), max(p1[4])]
	val = 0
	new = []
	for i in range(4):
		if l[i] != 0:
			new.append(l[i])
	k = len(new)
	for i in range(k):
		val += new[i] + new[(i + 1) % k]
	print(val)


for _ in range(int(input())):
	points = []
	you = [0, 0]
	visited = 0
	dist = 0
	for _ in range(int(input())):
		points.append([int(x) for x in input().split()])
	(left, right) = (min(points, key=lambda x: x[1])[1], max(points, key=lambda x: x[1])[1])
	left = min(0, left)
	right = max(0, right)
	(up, down) = (min(points, key=lambda x: x[0])[0], max(points, key=lambda x: x[0])[0])
	up = min(0, up)
	down = max(0, down)
	print(2 * (abs(left) + abs(right) + abs(up) + abs(down)))
if False:
	while True:
		print('never gonna give you up')


t = int(input())
for j in range(t):
	n = int(input())
	x_p = [0]
	y_p = [0]
	x_n = [0]
	y_n = [0]
	for f in range(n):
		(s, d) = map(int, input().split())
		if s == 0 and d >= 0:
			y_p.append(d)
		elif s == 0 and d < 0:
			y_n.append(d)
		elif s > 0 and d == 0:
			x_p.append(s)
		else:
			x_n.append(s)
	z = 2 * (abs(min(x_n)) + abs(max(x_p)) + abs(min(y_n)) + abs(max(y_p)))
	print(z)


t = int(input())
for i in range(t):
	Lx = [0]
	Ly = [0]
	n = int(input())
	for j in range(n):
		(x, y) = map(int, input().split())
		Lx.append(x)
		Ly.append(y)
	Lx.sort()
	Ly.sort()
	print(2 * (Lx[n] - Lx[0] + (Ly[n] - Ly[0])))


for _ in range(int(input())):
	n = int(input())
	x = [0]
	y = [0]
	for i in range(n):
		(a, b) = map(int, input().split())
		x.append(a)
		y.append(b)
	x.sort()
	y.sort()
	print((x[n] - x[0] + y[n] - y[0]) * 2)


t = int(input())
for _ in range(t):
	n = int(input())
	(minX, minY, maxX, maxY) = (0, 0, 0, 0)
	for i in range(n):
		(x, y) = list(map(int, input().split()))
		minX = min(x, minX)
		maxX = max(x, maxX)
		minY = min(y, minY)
		maxY = max(y, maxY)
	print(2 * (maxX + maxY - minX - minY))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		y_list_positive = [0]
		y_list_negative = [0]
		x_list_positive = [0]
		x_list_negative = [0]
		for a in range(n):
			(x, y) = map(int, input().split())
			if x == 0:
				if y > 0:
					y_list_positive.append(y)
				else:
					y_list_negative.append(y)
			elif x > 0:
				x_list_positive.append(x)
			else:
				x_list_negative.append(x)
		y_list_positive.sort(reverse=True)
		x_list_positive.sort(reverse=True)
		x_list_negative.sort()
		y_list_negative.sort()
		moves = 2 * (y_list_positive[0] - y_list_negative[0] + x_list_positive[0] - x_list_negative[0])
		print(moves)
main()


def solve():
	n = int(input())
	(n_x, p_x, n_y, p_y) = (0, 0, 0, 0)
	for _ in range(n):
		(x, y) = list(map(int, input().split()))
		n_x = min(n_x, x)
		p_x = max(p_x, x)
		n_y = min(n_y, y)
		p_y = max(p_y, y)
	print(2 * (p_x + p_y - n_x - n_y))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	minx = 0
	miny = 0
	maxx = 0
	maxy = 0
	for j in range(n):
		(x, y) = input().split(' ')
		x = int(x)
		y = int(y)
		minx = min(x, minx)
		maxx = max(x, maxx)
		miny = min(y, miny)
		maxy = max(y, maxy)
	print(2 * (maxx - minx + maxy - miny))


ans = []
for _ in range(int(input())):
	n = int(input())
	x_vals = []
	y_vals = []
	for i in range(n):
		(x, y) = list(map(int, input().split()))
		x_vals.append(x)
		y_vals.append(y)
	min_x = min(x_vals)
	min_y = min(y_vals)
	max_x = max(x_vals)
	max_y = max(y_vals)
	d = 0
	if min_x != max_x:
		if max_x > 0:
			d += abs(2 * max_x)
		if min_x < 0:
			d += abs(2 * min_x)
	else:
		d += abs(2 * max_x)
	if min_y != max_y:
		if max_y > 0:
			d += abs(2 * max_y)
		if min_y < 0:
			d += abs(2 * min_y)
	else:
		d += abs(2 * max_y)
	ans.append(d)
for i in ans:
	print(i)


for _ in range(int(input())):
	n = int(input())
	top_max = -101
	top_min = 101
	hor_max = -101
	hor_min = 101
	out = 0
	for x in range(n):
		(cor_x, cor_y) = map(int, input().split())
		if cor_x >= top_max:
			top_max = cor_x
		if cor_x <= top_min:
			top_min = cor_x
		if cor_y >= hor_max:
			hor_max = cor_y
		if cor_y <= hor_min:
			hor_min = cor_y
	if top_min >= 0:
		out += max(top_max, top_min) * 2
	if top_max < 0:
		out += max(abs(top_max), abs(top_min)) * 2
	if top_min < 0 <= top_max:
		out += abs(top_min) * 2 + top_max * 2
	if hor_min >= 0:
		out += max(hor_max, hor_min) * 2
	if hor_max < 0:
		out += max(abs(hor_max), abs(hor_min)) * 2
	if hor_min < 0 <= hor_max:
		out += abs(hor_min) * 2 + hor_max * 2
	print(out)


t = int(input())
for i in range(t):
	n = int(input())
	u = [0]
	v = [0]
	for j in range(n):
		(x, y) = [int(x) for x in input().split()]
		u.append(x)
		v.append(y)
	p = min(u)
	q = max(u)
	r = min(v)
	s = max(v)
	w = q + s - p - r
	print(2 * w)


for _ in range(int(input())):
	n = int(input())
	(l, r, u, d) = (0, 0, 0, 0)
	for _ in range(n):
		(x, y) = map(int, input().split())
		l = min(l, y)
		r = max(r, y)
		u = min(u, x)
		d = max(d, x)
	print(2 * (abs(l) + abs(u) + r + d))


total_test_cases = int(input())
for i in range(total_test_cases):
	num_of_boxes = int(input())
	maxx = 0
	minx = 0
	maxy = 0
	miny = 0
	for i in range(num_of_boxes):
		(x, y) = [int(x) for x in input().split()]
		if x > 0 and x > maxx:
			maxx = x
		if x < 0 and x < minx:
			minx = x
		if y > 0 and y > maxy:
			maxy = y
		if y < 0 and y < miny:
			miny = y
	print(maxx * 2 + abs(minx * 2) + maxy * 2 + abs(miny * 2))


t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = [0]
	b = [0]
	for i in range(n):
		(x, y) = map(int, input().split(' '))
		a.append(x)
		b.append(y)
	print((max(a) + max(b) - min(a) - min(b)) * 2)


def solve(a, n):
	for i in range(n):
		print(a[i], end=' ')
	print()
	for j in range(n - 1):
		(a[j], a[j + 1]) = (a[j + 1], a[j])
		for i in range(n):
			print(a[i], end=' ')
		print()
t = int(input())
for i in range(t):
	n = int(input())
	xlist = []
	ylist = []
	xind = 0
	yind = 0
	for i in range(n):
		(x, y) = list(map(int, input().split(' ')))
		if x == 0:
			ylist.append(y)
			yind += 1
		else:
			xlist.append(x)
			xind += 1
	xlist.sort()
	ylist.sort()
	ans = 0
	if xind == 0:
		xmax = 0
		xmin = 0
	else:
		xmax = xlist[xind - 1]
		xmin = xlist[0]
	if yind == 0:
		ymax = 0
		ymin = 0
	else:
		ymax = ylist[yind - 1]
		ymin = ylist[0]
	xmove = 0
	ymove = 0
	if xmax * xmin > 0:
		xmove = max(abs(xmax), abs(xmin))
	else:
		xmove = abs(xmax - xmin)
	if ymax * ymin > 0:
		ymove = max(abs(ymax), abs(ymin))
	else:
		ymove = ymax - ymin
	ans = 2 * xmove + 2 * ymove
	print(ans)


for _ in range(int(input())):
	n = int(input())
	xlist = []
	ylist = []
	moves = 0
	for i in range(n):
		(x, y) = map(int, input().split())
		xlist.append(x)
		ylist.append(y)
	(xmax, xmin) = (max(xlist), min(xlist))
	(ymax, ymin) = (max(ylist), min(ylist))
	if xmax >= 0 and xmin <= 0:
		moves += xmax - xmin
	elif xmax > 0 and xmin > 0:
		moves += xmax
	elif xmax < 0 and xmin < 0:
		moves -= xmin
	if ymax >= 0 and ymin <= 0:
		moves += ymax - ymin
	elif ymax > 0 and ymin > 0:
		moves += ymax
	elif ymax < 0 and ymin < 0:
		moves -= ymin
	print(moves * 2)