In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of two rectangles. The first rectangle has a width of $w_1$ and a height of $h_1$, while the second rectangle has a width of $w_2$ and a height of $h_2$, where $w_1 \ge w_2$. In this game, exactly one ship is used, made up of two rectangles. There are no other ships on the field.

The rectangles are placed on field in the following way:  the second rectangle is on top the first rectangle;  they are aligned to the left, i.e. their left sides are on the same line;  the rectangles are adjacent to each other without a gap. 

See the pictures in the notes: the first rectangle is colored red, the second rectangle is colored blue.

Formally, let's introduce a coordinate system. Then, the leftmost bottom cell of the first rectangle has coordinates $(1, 1)$, the rightmost top cell of the first rectangle has coordinates $(w_1, h_1)$, the leftmost bottom cell of the second rectangle has coordinates $(1, h_1 + 1)$ and the rightmost top cell of the second rectangle has coordinates $(w_2, h_1 + h_2)$.

After the ship is completely destroyed, all cells neighboring by side or a corner with the ship are marked. Of course, only cells, which don't belong to the ship are marked. On the pictures in the notes such cells are colored green.

Find out how many cells should be marked after the ship is destroyed. The field of the game is infinite in any direction.


-----Input-----

Four lines contain integers $w_1, h_1, w_2$ and $h_2$ ($1 \leq w_1, h_1, w_2, h_2 \leq 10^8$, $w_1 \ge w_2$) — the width of the first rectangle, the height of the first rectangle, the width of the second rectangle and the height of the second rectangle. You can't rotate the rectangles.


-----Output-----

Print exactly one integer — the number of cells, which should be marked after the ship is destroyed.


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

Output
12

Input
2 2 1 2

Output
16



-----Note-----

In the first example the field looks as follows (the first rectangle is red, the second rectangle is blue, green shows the marked squares): [Image] 

In the second example the field looks as: [Image]

Difficulty: EASY

Solutions:
(w1, h1, w2, h2) = (int(i) for i in input().split(' '))

def area(w, h):
	return 2 + 2 * h + w

def mod(n1, n2):
	if n1 > n2:
		return n1 - n2
	else:
		return n2 - n2
if w1 != w2:
	print(area(w1, h1) + area(w2, h2) + mod(w1, w2))
else:
	print(area(w1, h1) + area(w2, h2))


(w1, h1, w2, h2) = [int(x) for x in input().split(' ')]
s = w1 * 2 + h1 * 2 + 4
s -= w2
s += 2 * (h2 - 1) + w2 + 2
print(s)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
if w1 == w2:
	print(2 * w1 + 2 * (h1 + h2) + 4)
else:
	print(2 * (h1 + h2) + w1 + w2 + 4 + (w1 - w2))


[w1, h1, w2, h2] = [int(x) for x in input().split()]
area = [0, 0, 0]
area[1] = (w1 + h1) * 2 + 4
area[2] = (w2 + h2) * 2 + 4
crossover = (min(w1, w2) + 2) * 2
print(sum(area) - crossover)


l = list(map(int, input().split()))
sumer = 0
sumer = l[0] + l[2] + 4
sumer = sumer + 2 * l[1] + 2 * l[3] + abs(l[0] - l[2])
print(sumer)


(w1, h1, w2, h2) = input().split()
(w1, h1, w2, h2) = (int(w1), int(h1), int(w2), int(h2))
print(2 * (h1 + h2) + w1 + w2 + w1 - w2 + 4)


(w1, h1, w2, h2) = [int(i) for i in input().split()]
r = 0
r += w1 + 2
r += h1 - 1
r += h1 + h2
r += w2 + 2
r += h2 - 1
r += abs(w1 - w2) + 2
print(r)


lst = list(map(int, input().split()))
print((lst[0] + lst[1] + lst[3]) * 2 + 4)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
print(2 * (h1 + h2) + w1 + w2 + abs(w1 - w2) + 4)


(w1, h1, w2, h2) = map(int, input().split())
area1 = 2 * h1 + 2 + w1 + (w1 - w2)
area2 = 2 * h2 + 2 + w2
print(area2 + area1)


(w1, h1, w2, h2) = map(int, input().split())
g1 = 2 * (h1 + 1) + w1
g2 = 2 * (h2 + 1) + w2
g12 = abs(w1 - w2)
print(g1 + g2 + g12)


(w1, h1, w2, h2) = map(int, input().split())
b = 2 * w1 + 2
b += 2 * (h1 + h2) + 2
print(b)


(w, h, ww, hh) = map(int, input().split())
print(2 * (h + hh) + w + ww + (w - ww) + 4)


import sys

def main(w1, h1, w2, h2):
	w = max(w1, w2)
	return w * 2 + (h1 + h2) * 2 + 4
first = True
for line in sys.stdin:
	l = line.strip().split(' ')
	l = [int(x) for x in l]
	print(main(l[0], l[1], l[2], l[3]))


def main():
	arr = input().split()
	w1 = int(arr[0])
	h1 = int(arr[1])
	w2 = int(arr[2])
	h2 = int(arr[3])
	total = w1 + 2 * h1 + 2 + w2 + 2 * h2 + 2
	total += w1 - w2
	print(total)
main()


(w1, h1, w2, h2) = map(int, input().split())
w = max(w1, w2)
h = h1 + h2
su = 2 * (w + h)
su += 4
print(su)


(w1, h1, w2, h2) = [int(i) for i in input().strip().split(' ')]
print(h1 + h2 + w2 + h2 + h1 + w1 + max(0, abs(w2 - w1) - 1) + (1 if w2 != w1 else 0) + 4)


(q, w, e, r) = map(int, input().split())
print((w + r) * 2 + max(q, e) * 2 + 4)


(a, b, a1, b1) = map(int, input().split())
s1 = (a + 2) * 2 + b * 2
s2 = (a1 + 2) * 2 + b1 * 2
ss = (min(a, a1) + 2) * 2
print(s1 + s2 - ss)


(w1, h1, w2, h2) = map(int, input().split())
ans = (max(w1, w2) + 2) * 2 + (h1 + h2) * 2
print(ans)


(a, b, c, d) = map(int, input().split())
print(b + d + a + c + b + d + 4 + abs(a - c))


(a, b, c, d) = map(int, input().split())
print(2 * (a + b + d + 2))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
(w1, h1, w2, h2) = get_int_list()
print(w1 + 2 + h1 * 2 + (w2 + 2) + h2 * 2 + (w1 - w2))


(w1, h1, w2, h2) = map(int, input().split())
ans1 = (w1 + 2) * 2 + h1 * 2
ans2 = (w2 + 2) * 2 + h2 * 2
ans = ans1 - w2 + ans2 - (w2 + 2 + 2)
print(ans)


array = [int(x) for x in input().split()]
(w1, h1, w2, h2) = (array[0], array[1], array[2], array[3])
print(2 * (h1 + h2 + w1 + 2))


(w1, h1, w2, h2) = list(map(int, input().split()))
print(h1 * 2 + h2 * 2 + w1 + w2 + (w2 - w1 if w2 - w1 >= 0 else w1 - w2) + 4)


(w1, h1, w2, h2) = list(map(int, input().split(' ')))
print(2 * (h1 + h2 + 2) + w1 * 2)


x = input()
x = x.split()
l1 = (int(x[0]) + int(x[1])) * 2
l2 = (int(x[2]) + int(x[3])) * 2
print(l1 + l2 + 4 - min(int(x[0]), int(x[2])) * 2)


(w1, h1, w2, h2) = map(int, input().split())
marks = 2 * (h1 + h2 + 2) + 2 * w1
print(marks)


a = input()
(w1, h1, w2, h2) = (int(a.split()[0]), int(a.split()[1]), int(a.split()[2]), int(a.split()[3]))
print(2 * h1 + 2 * w1 + 4 + h2 + h2)


(w1, h1, w2, h2) = map(int, input().split())
t = 2 * (w1 + 2 + h1 + h2)
print(t)


(a, b, x, y) = map(int, input().split())
print(a + 2 * (b + 1) + (a - x) + x + (y + 1) * 2)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
c = (w1 + 2) * (h1 + h2 + 2)
c -= (w1 - w2) * h2
c -= w1 * h1 + w2 * h2
print(c)


[a, b, c, d] = [int(c) for c in input().split()]
print(2 * (b + d + max(a, c) + 2))


(w1, h1, w2, h2) = map(int, input().split())
x = 4
x += 2 * (h1 + h2) + (w1 + w2) + w1 - w2
print(x)


(w1, h1, w2, h2) = map(int, input().split())
d = w1 - w2
res = h1 + h2 + 2 + (w1 + 1) + (w2 + 1) + (h1 + h2 + d)
print(res)


inp = input().split()
w1 = int(inp[0])
h1 = int(inp[1])
w2 = int(inp[2])
h2 = int(inp[3])
total = h1 * 2 + 2 + w1 + h2 * 2 + 2 + w2 + (w1 - w2)
print(total)


(w1, h1, w2, h2) = map(int, input().split())
sumn = h1 + h1 + h2 + h2 + 4 + w1 + w2 + abs(w2 - w1)
print(sumn)


(w1, h1, w2, h2) = map(int, input().split())
Ag = (w1 + 2) * (h1 + h2 + 2)
am = w1 * (h1 + h2)
As = Ag - am
print(As)


line = input().split(' ')
w0 = int(line[0])
h0 = int(line[1])
w1 = int(line[2])
h1 = int(line[3])
count = w0 + h0 * 2 + w1 + h1 * 2 + abs(w0 - w1) + 4
print(count)


(w, h, w2, h2) = map(int, input().split())
num = (w + h + 1) * 2
num2 = (w2 + h2 + 1) * 2
num3 = num + num2
num4 = min(w2, w) * 2
print(num3 - num4)


l = list(map(int, input().split(' ')))
sum = int
sum = 0
for i in l:
	sum += 2 * i
sum += 4
sum -= min(l[0], l[2]) * 2
print(sum)


(w1, h1, w2, h2) = map(int, input().split())
p = w1 + 2
p += h1 * 2
p += w1 - w2
p += h2 * 2
p += w2 + 2
print(p)


(x1, x2, x3, x4) = map(int, input().split())
print(2 * (x1 + x2 + x4 + 2))


(w1, h1, w2, h2) = map(int, input().split())
l = h1 + h2
t = 0
if w2 < w1:
	t = w1 - w2
else:
	t = w1 - w2
print(w1 + w2 + 2 * (h1 + h2) + 4 + t)


from collections import defaultdict
inn = lambda : list(map(int, input().split()))

def main():
	(w1, h1, w2, h2) = inn()
	print(h1 * 2 + 2 + w1 + (2 * h2 + 2 + w2 + (w1 - w2)))
main()


i = input()
(w1, h1, w2, h2) = i.split()
w1 = int(w1)
h1 = int(h1)
w2 = int(w2)
h2 = int(h2)
t = (max(w1, w2) + 2) * (h1 + h2 + 2) - (w1 * h1 + w2 * h2) - abs(w1 - w2) * h2
print(t)


(w1, h1, w2, h2) = map(int, input().split())
if w2 < w1:
	(w1, h1, w2, h2) = (w2, h2, w1, h1)
r1 = 2 * w1 + 2 * h1 + 4 - w1 - 2
r2 = 2 * w2 + 2 * h2 + 4 - w1 - 2
print(r1 + r2)


A = list(map(int, input().split()))
print((A[0] + A[1] + A[3]) * 2 + 4)


ll = lambda : list(map(int, input().split()))
[w1, h1, w2, h2] = ll()
print(w1 + 2 + w2 + 2 + h1 * 2 + h2 * 2 + w1 - w2)


(w1, h1, w2, h2) = map(int, input().split())

def CuadradosResultantes(w1, h1, w2, h2):
	AreaTotal = (h1 + h2 + 2) * (w1 + 2)
	Area_Resultante = AreaTotal - ((w1 - w2) * h2 + (w1 * h1 + w2 * h2))
	print(Area_Resultante)
CuadradosResultantes(w1, h1, w2, h2)


(w1, h1, w2, h2) = [int(c) for c in input().split()]
c1 = (w1 + h1) * 2 + 4 - w2
c2 = (w2 + h2) * 2 - w2
print(c1 + c2)


(w1, h1, w2, h2) = map(int, input().split())
if w2 == w1:
	h = h1 + h2
	ANS = (w2 + 2) * (h + 2) - w2 * h
	print(ANS)
else:
	ANS = (h1 + 2) * (w1 + 2) - h1 * w1 - w2 - 2
	ANS += (h2 + 2) * (w2 + 2) - h2 * w2 - (w2 + 2)
	print(ANS)


(w1, h1, w2, h2) = map(int, input().split())
w = max(w1, w2)
print(w * 2 - min(w1, w2) + h1 * 2 + h2 * 2 + min(w1, w2) + 4)


def solve(w1, h1, w2, h2):
	a = 2 * (w1 + 2 + h1) - w2
	b = 2 * (h2 - 1) + w2 + 2
	return a + b

def main():
	(w1, h1, w2, h2) = list(map(int, input().split()))
	print(solve(w1, h1, w2, h2))
main()


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = 1
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	ans = (w1 + 2) * 2 + h1 * 2
	ans -= w2
	ans += w2 + 2 + (h2 - 1) * 2
	return ans
for _ in range(t):
	(w1, h1, w2, h2) = map(int, input().split())
	print(solve())


(w1, h1, w2, h2) = map(int, input().split())
s1 = 2 * (h1 + 1) + w1
s2 = 2 * (h2 + 1) + w2
s = s1 + s2 + abs(w2 - w1)
print(s)


(w1, h1, w2, h2) = map(int, input().strip().split())
rec1 = h1 + h1 + w1 + 2
rec2 = h2 + h2 + w2 + 2
print(rec1 + rec2 + w1 - w2)


a = list(map(int, input().split()))
c = a[1] * (a[0] + 2) + a[3] * (a[2] + 2) + (a[0] + 2) * 2 - (a[0] * a[1] + a[2] * a[3])
print(c)


(w1, h1, w2, h2) = map(int, input().split())
no_of_squares = 2 * (w1 + h1 + h2) + 4
print(no_of_squares)


(w1, h1, w2, h2) = input().split()
(w1, h1, w2, h2) = (int(w1), int(h1), int(w2), int(h2))
h4 = h1 + h2
w4 = max([w1, w2])
print((h4 + 2) * (w4 + 2) - h4 * w4)


x = input().split()
x = list(map(int, x))
(w1, h1, w2, h2) = (x[0], x[1], x[2], x[3])
bot = w1 + 2
l = h1 + h2 + 2
top = w2 + 2
if w1 != w2:
	r1 = h1 + 2
	r2 = h2 + 1
	r = r1 + r2
	top += w1 - w2 - 1
else:
	r = h1 + h2 + 2
print(bot + top + l + r - 4)


def seawars():
	(w1, h1, w2, h2) = list(map(int, input().split()))
	p = 0
	p += 2 * (w1 + h1 + w2 + h2) + 4
	p -= 2 * min(w1, w2)
	return p
print(seawars())


dat = input().strip().split(' ')
dat = [int(x) for x in dat]
lft = dat[1] + 2 + dat[3]
top = dat[0] + 1
bot = dat[2] + 1
rig = dat[1] + dat[3] + abs(dat[0] - dat[2])
print(lft + top + bot + rig, end='')


(w1, h1, w2, h2) = map(int, input().strip().split(' '))
ans = 2 * (h1 + h2 + 2) + w1 + w2 + abs(w1 - w2)
print(ans)


(w1, h1, w2, h2) = map(int, input().split())
ans = 0
ans += (w1 + 1) * 2 + h1 * 2
ans += (w2 + 1) * 2 + h2 * 2
ans -= 2 * min(w2, w1)
print(ans)


(w2, h2, w1, h1) = map(int, input().split())
print(w1 + 2 + h1 * 2 + (w2 + 2) + h2 * 2 + abs(w2 - w1))


(w1, h1, w2, h2) = map(int, input().split())
h = h1 + h2 + 1
w1 = w1 + 1
print(2 * (h + w1))


(w1, h1, w2, h2) = map(int, input().split())
k = (w1 + 2) * (h1 + h2 + 2) - (h1 + h2) * w1
print(k)


(w1, h1, w2, h2) = map(int, input().split())
s1 = (w1 + 2) * (h1 + 2) - w1 * h1
s2 = (w2 + 2) * (h2 + 2) - w2 * h2
intersection = w2 + 2 + 2 + w2
print(s1 + s2 - intersection)


x = input().split(' ')
w1 = int(x[0])
h1 = int(x[1])
w2 = int(x[2])
h2 = int(x[3])
p1 = 2 * (w1 + h1)
p2 = 2 * (w2 + h2)
w = [w1, w2]
lJoint = min(w)
pFigure = p1 + p2 - 2 * lJoint
Cells = pFigure + 4
print(Cells)


import sys
for line in sys.stdin:
	(w1, h1, w2, h2) = map(int, line.strip().split())
	if w1 == w2:
		num = w1 + 2 * h1 + w2 + 2 * h2 + 4
	elif w1 > w2:
		num = w1 + 2 * h1 + (w1 - w2) + (w2 + 2) + 2 * h2 + 2
	else:
		num = w1 + h1 + (w2 - w1) + w2 + 2 * h2 + 4
print(num)


import sys
import math
import collections
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 10

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

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat
(w1, h1, w2, h2) = map(int, input().split())
ans = 2 * (h1 + h2) + w1 + 4 + w2 + abs(w1 - w2)
print(ans)


from collections import defaultdict, Counter, deque
from math import ceil
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
inf = float('inf')
mod = int(1000000000.0) + 7
mod_ = 998244353

def main():
	(w1, h1, w2, h2) = map(int, input().split())
	a1 = 2 * (w1 + h1) + 4
	a2 = 2 * (w2 + h2) + 4
	common = 2 * w2 + 4
	print(a1 + a2 - common)
main()


a = [*map(int, input().split())]
x = 2 * a[1] + 2 * a[3] + 4 + 2 * max(a[0], a[2])
print(x)


(w_1, h_1, w_2, h_2) = map(int, input().split())
print(2 * (h_1 + h_2) + 2 * w_1 + 4)


(w1, h1, w2, h2) = map(int, input().split())
sub = w1 * h1 + w2 * h2
rec = (w1 + 2) * (h1 + 1) + (w2 + 2) * (h2 + 1)
rec += w1 - w2
print(rec - sub)


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def modu(a, m):
	if a % m:
		return a % m
	return m

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s
(w1, h1, w2, h2) = map(int, input().split())
ans = w1 + w2 + 2 * h1 + 2 * h2 + abs(w1 - w2) - 1 + 5
print(ans)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
box = w1 + 2 + h1 + h2 + 1 + h1 + 1 + (w1 - w2) + h2 + w2
print(box)


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
(w1, h1, w2, h2) = [int(x) for x in input().split()]
print(2 * (w1 + h1 + h2 + 2))


def get_rects(w1, h1, w2, h2):
	return 2 * h1 + 2 + w1 + 2 * h2 + 2 + w2 + w1 - w2

def main():
	(w1, h1, w2, h2) = list(map(int, input().split(' ')))
	print(get_rects(w1, h1, w2, h2))
main()


from math import *
import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
(w1, h1, w2, h2) = mints()
s = w1 + w2 + (h1 + h2) * 2 + 4
print(s + abs(w1 - w2))


(w1, h1, w2, h2) = map(int, input().split())
print(w1 + h1 + h2 + w2 + h2 + (w1 - w2 - 1) + h1 + 5)


(x1, y1, x2, y2) = map(int, input().split())
print(2 * x1 + 2 * x2 + 2 * y1 + 2 * y2 + 4 - 2 * min(x1, x2))


(a, b, c, d) = map(int, input().split())
f1 = (a + 2) * (b + 2) - a * b - c
f2 = (c + 2) * (d + 1) - c * d - 2
print(f1 + f2)


(w, h, w2, h2) = [int(i) for i in input().split()]
print(2 * (h + h2 + 2) + 2 * (max(w, w2) + 2) - 4)


def solution():
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	c = int(line[2])
	d = int(line[3])
	return a + 2 + b * 2 + (a + 2 - c) + (c + 2) + (d - 1) * 2
print(solution())


(w1, h1, w2, h2) = map(int, input().split())
if w1 == w2:
	print(4 + w1 * 2 + (h1 + h2) * 2)
elif w1 > w2:
	print(4 + w1 * 2 + h1 * 2 + h2 * 2)
elif w1 < w2:
	print(4 + h1 * 2 + h2 * 2 + w2 * 2)


(w1, h1, w2, h2) = [int(c) for c in input().split()]
ans = 2 + w1 + 2 * h1 + (w1 + 2 - w2) + (h2 - 1) * 2 + (w2 + 2)
print(ans)


(w1, w2, h1, h2) = map(int, input().split())
sum = 2 * (w1 + w2 + h2) + 4
print(sum)


(w1, h1, w2, h2) = [int(i) for i in input().split()]
print(2 * (h1 + h2 + 2) + 2 * max(w1, w2))


(w_1, h_1, w_2, h_2) = map(int, input().split())
ans = 2 * (h_1 + h_2) + 4 + w_1 + w_2 + abs(w_1 - w_2)
print(ans)


inp = input().split(' ')
h1 = int(inp[1])
w1 = int(inp[0])
h2 = int(inp[3])
cells = 2 * (w1 + h1 + h2) + 4
print(cells)


(w1, h1, w2, h2) = map(int, input().split())
print((w1 + 2) * (h1 + 2) - w1 * h1 + (w2 + 2) * (h2 + 2) - w2 * h2 - (min(w1, w2) + 2) * 2)


(w1, h1, w2, h2) = map(int, input().split())
top = 2 * (h2 + 1) + w2
bottom = 2 * (h1 + 1) + w1
extra = w1 - w2
print(top + bottom + extra)


(w1, h1, w2, h2) = map(int, input().split())
ancho = w1 + 2
largo = h1 + h2 + 2
verde = ancho * largo
verde -= w1 * (h1 + h2)
if w1 != w2:
	h1 * (w1 - w2)
print(verde)


(w1, h1, w2, h2) = map(int, input().split())
c = w1 + 2
c += h1 * 2
c += w1 - w2
c += h2 * 2
c += w2 + 2
print(c)


import math
import sys
(w1, h1, w2, h2) = map(int, input().split())
if w2 > w1:
	temp = w1
	w1 = w2
	w2 = temp
print(4 + 2 * w1 + 2 * (h1 + h2))


(w1, h1, w2, h2) = map(int, input().split())
total = 2 * (w1 + 2) + 2 * h1 - w2
total += w2 + 2
total += (h2 - 1) * 2
print(total)


(w1, h1, w2, h2) = list(map(int, input().split()))
output = w1 + 2 + (h1 + 1) * 2 + w2 + 2 + (h2 - 1) * 2 + (w1 - w2)
print(output)


(w1, h1, w2, h2) = map(int, input().split())
if w1 == w2:
	ans = 2 * h1 + w1 + 2 * h2 + w2 + 4
else:
	ans = 2 * h1 + w1 + 2 * h2 + w2 + 5 + w1 - (w2 + 1)
print(ans)


def solve(w1, h1, w2, h2):
	border = (w1 + 2) * 2 + (h1 + h2 + 2) * 2 - 4
	return border
(w1, h1, w2, h2) = map(int, input().split())
print(solve(w1, h1, w2, h2))


(w1, h1, w2, h2) = map(int, input().split())
a = (w1 + 2) * (h1 + 2) - w1 * h1
b = (w2 + 2) * (h2 + 2) - w2 * h2
c = w1 + 2 + w2 + 2
print(a + b - c + w1 - w2)


X = list(map(int, input().split()))
print(4 + 2 * (X[0] + X[1] + X[3]))


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
(w1, h1, w2, h2) = mi()
ans = h1 + h2 + 2 + w1 + w2 + 2 + h1 + h2 + w1 - w2
print(ans)


(w1, h1, w2, h2) = map(int, input().split())
width = abs(w1 - w2)
ans = h1 + h2 + 2
ans += w1 + 2
ans += w2 + 2
if width != 0:
	ans += h1 + 2
	ans += width + 1
	ans += h2 + 1
	ans -= 6
else:
	ans += h1 + h2 + 2
	ans -= 4
print(ans)


(w_1, h_1, w_2, h_2) = map(int, input().split())
if w_1 > w_2:
	t = (w_1 - w_2) * h_2
	print((h_2 + h_1 + 2) * (w_1 + 2) - t - w_1 * h_1 - w_2 * h_2)
else:
	t = (w_2 - w_1) * h_1
	print((h_1 + h_2 + 2) * (w_2 + 2) - t - w_2 * h_2 - w_1 * h_1)


inp = input().split(' ')
(w1, h1) = (int(inp[0]), int(inp[1]))
(w2, h2) = (int(inp[2]), int(inp[3]))
print(str(2 * (h1 + h2 + w1) + 4))


def coordinates_input():
	coordinates_input = input()
	coordinates = coordinates_input.split()
	width1 = int(coordinates[0])
	height1 = int(coordinates[1])
	width2 = int(coordinates[2])
	height2 = int(coordinates[3])
	return ((width1, height1), (width2, height2))

def number_market_cells(rectangle_1_coordinates, rectangle_2_coordinates):
	number_width_cells = rectangle_1_coordinates[0] + 2 + (rectangle_2_coordinates[0] + 2) + (rectangle_1_coordinates[0] - rectangle_2_coordinates[0])
	number_height_cells = rectangle_1_coordinates[1] * 2 + rectangle_2_coordinates[1] * 2
	return number_height_cells + number_width_cells

def main():
	(rectangle_1_coordinates, rectangle_2_coordinates) = coordinates_input()
	n_cells = number_market_cells(rectangle_1_coordinates, rectangle_2_coordinates)
	print(n_cells)
main()


import sys
import math

def main():
	(w1, h1, w2, h2) = map(int, input().split())
	print(max(w1, w2) * 2 + (h1 + h2 + 2) * 2)
main()


(w1, h1, w2, h2) = list(map(int, input().split()))
answer = 4 + (h1 + h2) * 2 + w1 + w2 + abs(w2 - w1)
print(answer)


def main():
	whwh = [int(i) for i in input().split()]
	(w1, h1, w2, h2) = whwh
	red = w1 + w1 + (h1 + 2) * 2
	blue = w2 + (h2 + 1) * 2
	if w2 == w1:
		ans = red + blue - (w1 + 2)
	elif w2 < w1:
		ans = red + blue - (w1 + 2) + (w1 - w2)
	print(ans)
main()


elem = list(map(int, input().split()))
print(2 * elem[1] + 2 * elem[3] + 2 * elem[0] + 4)


(w1, h1, w2, h2) = [int(i) for i in input().split(' ')]
s = 0
s += w1 + 2
if w1 == w2:
	s += h1 * 2
	s += h2 * 2
	s += w2 + 2
	print(s)
elif w1 > w2:
	s += h1 * 2
	s += w1 + 2 - w2
	s += (h2 - 1) * 2
	s += w2 + 2
	print(s)
else:
	s += (h1 - 1) * 2
	s += w2 - w1 + 2
	s += h2 * 2
	s += h2 + 2
	print(s)


(w, h, v, g) = map(int, input().split())
print(2 * (w + h + g + 2))


(a1, h1, a2, h2) = input().split()
(a1, h1, a2, h2) = (int(a1), int(h1), int(a2), int(h2))
caso = a1 * 2 + 4 + 2 * (h1 + h2)
print(caso)


(w1, h1, w2, h2) = list(map(int, input().split()))
c = (max(w1, w2) + 2) * (h1 + h2 + 2) - (w1 - w2) * h2 - (w1 * h1 + w2 * h2)
print(c)


(w1, h1, w2, h2) = [int(item) for item in input().split()]
print(h1 + h2 + 1 + 1 + (w1 + 1) + (w2 + 1) + h1 + h2 + w1 - w2)


(x, y, xx, yy) = map(int, input().split())
print((y + yy + 2) * 2 + x + xx + (x - xx))


[w1, h1, w2, h2] = list(map(int, input().split(' ')))
r = (h1 + h2) * 2 + max(w1, w2) * 2 + 4
print(r)


massiv = input().split(' ')
massiv = list(map(int, massiv))
w1 = massiv[0]
h1 = massiv[1]
w2 = massiv[2]
h2 = massiv[3]
smin = w1 * (h2 + h1)
smax = (w1 + 2) * (h1 + h2 + 2)
s = smax - smin
print(s)


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
(wa, ha, wb, hb) = mi()
print(2 * (ha + hb + wa + 2))


n = [int(x) for x in input().split()]
(w1, h1, w2, h2) = (n[0], n[1], n[2], n[3])
print(str(w1 + w2 + 4 + 2 * (h1 + h2) + abs(w1 - w2)))


arr = input()
(w1, h1, w2, h2) = [int(x) for x in arr.split(' ')]
H = h1 + h2
W = max(w1, w2)
res = (H + 1) * 2 + (W + 1) * 2
print(res)


(w1, h1, w2, h2) = map(int, input().split())
green = (w1 + 2) * (h1 + 2) + (w2 + 2) * (h2 + 2) - 2 * (w2 + 2) - w1 * h1 - w2 * h2
print(green)


n = [i for i in map(int, input().split())]
w1 = n[0]
h1 = n[1]
w2 = n[2]
h2 = n[3]
a = w1 + h1
b = h2
print((a + b + 2) * 2)


data = input().split()
(w1, h1, w2, h2) = (int(data[0]), int(data[1]), int(data[2]), int(data[3]))
sum = h1 + h2 + w1 + w2 + 4
if w1 > w2:
	sum += h1 + w1 - w2 + h2
else:
	sum += h1 + h2
print(sum)


def main():
	(a, b, c, d) = [int(v) for v in input().split()]
	s = (a + 2) * 2 + b * 2
	s -= c
	s += c + 2
	s += (d - 1) * 2
	print(s)
main()


def seaBattle(w1, h1, w2, h2):
	return 2 * (w1 + h1 + h2) + 4
(w1, h1, w2, h2) = map(int, input().split())
print(seaBattle(w1, h1, w2, h2))


(a, b, c, d) = list(map(int, input().split(' ')))
e = (a + 2) * (b + 2) + (c + 2) * (d + 1) - (c + 2) - a * b - c * d
print(e)


(w1, h1, w2, h2) = map(int, input().split())
if w1 > w2:
	ans = h1 + h2 + 2 + w2 + 1 + h2 + w1 - w2 - 1 + h1 + 2 + w1
if w2 > w1:
	ans = h1 + h2 + 2 + w2 + 1 + h2 + 1 + w2 - w1 + h1 + w1
if w1 == w2:
	ans = h1 + h2 + w2 + 1 + h1 + h2 + 1 + w1 + 2
print(ans)


def main():
	x = input().split()
	w1 = int(x[0])
	h1 = int(x[1])
	w2 = int(x[2])
	h2 = int(x[3])
	green = 0
	if w1 == w2:
		green += (h1 + h2) * 2 + w1 * 2 + 4
	else:
		green += 2 * (w1 + h1) + 2 * (w2 + h2) - 2 * w2 + 4
	print(green)
main()


x = list(map(int, input().split()))

def counter(args):
	w1 = args[0]
	h1 = args[1]
	w2 = args[2]
	h2 = args[3]
	points = 4 + 2 * h1 + 2 * h2 + w1 + w2 + (w1 - w2)
	return points
print(counter(x))


i = input
List = [*map(int, i().split())]
print(2 * (List[0] + List[1] + List[3]) + 4)


import sys
from functools import reduce
from math import sqrt, floor

def eprint(*args, **kwargs):
	if not __debug__:
		print(*args, file=sys.stderr, **kwargs)
direction_value = {'U': (0, 1), 'D': (0, -1), 'R': (1, 0), 'L': (-1, 0)}
for t in range(int(input()) if not __debug__ else 1):
	(w1, h1, w2, h2) = map(int, input().split())
	res = 2 * (h1 + h2 + w1)
	eprint(f'{t}.ha->{res}')
	extra = w2 - w1 - 1
	if extra > 0:
		res += extra
	res += 4
	print(res)


(a, b, c, d) = [int(x) for x in input().split()]
ans = 0
if a < c:
	ans += (a + 2) * b
	ans += (c + 2) * (d + 2)
else:
	ans += (c + 2) * d
	ans += (a + 2) * (b + 2)
ans -= a * b + c * d
print(ans)


s = list(map(int, input().split()))
print((s[0] + s[1] + s[3] + 2) * 2)


(d1, s1, d2, s2) = input().split()
(d1, s1, d2, s2) = (int(d1), int(s1), int(d2), int(s2))
print((d1 + 1 + s2 + s1 + 1) * 2)


def main():
	(w1, h1, w2, h2) = [int(x) for x in input().split()]
	a = 5
	ans = (h1 + h2) * 2 + w1 * 2 + a - 1
	print(ans)
main()


(w1, h1, w2, h2) = map(int, input().split())
answ1 = w1 + 2 * h1
answ2 = w2 + 2 * h2
answ = 4 + abs(w2 - w1)
print(answ1 + answ2 + answ)


(w1, h1, w2, h2) = map(int, input().split())
s = 0
if w2 == w1:
	s = w1 + 2 + h1 * 2 + (w2 + 2) + h2 * 2
else:
	s = w1 + 2 + h1 * 2 + (w2 + 2) + (h2 * 2 + (w1 - w2))
print(s)


(w1, h1, w2, h2) = map(int, input().split())
if w1 == w2:
	print((w1 + 2) * (h1 + h2 + 2) - w1 * (h1 + h2))
if w1 > w2:
	print((w1 + 2) * (h1 + h2 + 2) - w2 * h2 - (w1 - w2) * h2 - w1 * h1)
if w1 < w2:
	print((w2 + 2) * (h1 + h2 + 2) - w1 * h1 - (w2 - w1) * h1 - w2 * h2)


a = [int(s) for s in input().split()]
w1 = a[0]
h1 = a[1]
w2 = a[2]
h2 = a[3]
p1 = (w1 + h1) * 2 + 4
p2 = (w2 + h2) * 2 - 2 * w2
print(p1 + p2)


import collections
import random
import heapq
import bisect
import math
import time

class Solution2:

	def solve(self, A1, A2):
		pass

def gcd(a, b):
	if not b:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return b * a // gcd(b, a)

class Solution:

	def solve(self, w1, h1, w2, h2):
		out = 0
		out += h1 + h2 + 2
		out += w1 + 1
		out += w2 + 1
		out += h1
		out += h2
		out += max(0, w1 - w2)
		return out
sol = Solution()
sol2 = Solution2()
for test_case in range(1):
	(N, M, K, C) = input().split()
	out = sol.solve(int(N), int(M), int(K), int(C))
	print(str(out))


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
(w1, h1, w2, h2) = read_ints()
print((w1 + h1 + h2) * 2 + 4)


(x1, y1, x2, y2) = [int(x) for x in input().split()]
print(y1 + y2 + x2 + (y1 + y2 + abs(x1 - x2)) + x1 + 4)


try:
	(w1, h1, w2, h2) = map(int, input().split())
	h = h1 + h2
	w = max(w1, w2)
	mat1 = w * h
	mat2 = (w + 2) * (h + 2)
	ans = int(mat2 - mat1)
	print(ans)
except:
	print('hello')


n = list(map(int, input().split()))
t = (n[1] + n[3] + 2) * 2
t += n[0] * 2
print(t)


import sys
input = sys.stdin.readline
(w1, h1, w2, h2) = map(int, input().split())
ans = 2 * (w1 + 2) + 2 * h1 + (w2 + 2) - w2 + 2 * (h2 - 1)
print(ans)


(w1, h1, w2, h2) = list(map(int, input().split()))
cells = w1 + w2 + 4
cells += h1 + h2
if w1 == w2:
	cells += h1 + h2
else:
	cells += w1 - w2
	cells += h1 + 1
	cells += h2 - 1
print(str(cells))


t = list(map(int, input().split(' ')))
w1 = t[0]
h1 = t[1]
w2 = t[2]
h2 = t[3]
s = 2 * (h1 + h2 + w1) + 4
print(s)


[w1, h1, w2, h2] = list(map(int, input().rstrip().split()))

def ab(a, b):
	if a >= b:
		return a - b
	else:
		return b - a
if w1 != w2:
	print(w1 + w2 + ab(w1, w2) + 2 * h1 + 2 * h2 + 5 - 1)
else:
	print(2 * (h1 + h2) + 2 * w1 + 4)


TN = 1

def solution():
	(w1, h1, w2, h2) = map(int, input().split())
	print(2 * (w1 + h1 + h2) + 4)
while TN != 0:
	solution()
	TN -= 1


def main():
	(w1, h1, w2, h2) = map(int, input().split())
	result = 2 * h1 + w1 + 2 + 2 * h2 + w2 + 2 + w1 - w2
	print(result)
	return 0
main()


(a, b, c, d) = map(int, input().split())
print(max(a, c) * 2 + (b + d) * 2 + 4)


n = input()
n = n.split(' ')
w1 = int(n[0])
h1 = int(n[1])
w2 = int(n[2])
h2 = int(n[3])
v = (w1 + 2) * (h1 + h2 + 2) - w1 * h1 - w2 * h2 - h2 * (w1 - w2)
print(v)


(w1, h1, w2, h2) = map(int, input().split())
h = h1 + h2
w = max(w1, w2)
s = w * h
s1 = (w + 2) * (h + 2)
print(s1 - s)


(a, b, c, d) = map(int, input().split())
e = a + 2 + (b + d + 2) + (c + 2) + (b + 2) + (d + 2) + abs(a - c) - 6
print(e)


(w1, h1, w2, h2) = map(int, input().split())
left = h1 + h2
down = w1
corner = 4
if w1 == w2:
	up = w1
	right = h1 + h2
else:
	up = w2
	right = h1 + h2 + abs(w2 + 1 - (w1 + 1))
print(left + right + up + down + corner)


(x1, y1, x2, y2) = (int(i) for i in input().strip().split())
print(x1 + x2 + 2 * y1 + 2 * y2 + abs(x2 - x1) + 4)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
marked = 0
marked += 2 * (h1 + h2 + 2)
marked += 2 * w1
print(marked)


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)
w1 = get_number()
h1 = get_number()
w2 = get_number()
h2 = get_number()
s1 = w1 * h1
s2 = w2 * h2
sf1 = (w1 + 2) * (h1 + 2) - (w2 + 2) - s1
sf2 = (w2 + 2) * (h2 + 2) - (w2 + 2) - s2
print(sf1 + sf2)


(w1, h1, w2, h2) = map(lambda x: int(x), input().split())
total = 0
total += h1 + h2 + 2
total += w1 + w2 + 2
total += h1 + h2
total += max(0, abs(w1 - w2))
print(total)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
isdebug = False
try:
	import pywin32
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
	isdebug = True
except Exception:

	def dprint(*args, **kwargs):
		pass

def red_inout():
	inId = 0
	outId = 0
	if not isdebug:
		inId = 0
		outId = 0
	if inId > 0:
		dprint('use input', inId)
		try:
			f = open('input' + str(inId) + '.txt', 'r')
			sys.stdin = f
		except Exception:
			dprint('invalid input file')
	if outId > 0:
		dprint('use output', outId)
		try:
			f = open('stdout' + str(outId) + '.txt', 'w')
			sys.stdout = f
		except Exception:
			dprint('invalid output file')
		atexit.register(lambda : sys.stdout.close())
if isdebug:
	red_inout()

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

def solve():
	pass
T_ = 1
for iii_ in range(T_):
	(w1, h1, w2, h2) = getIntList()
	r = w1 + 2
	r += 2 * h1
	r += w2 + 2
	r += 2 * h2
	r += w1 - w2
	print(r)


mass = list(map(int, input().split(' ')))
dlina_1 = mass[0]
visot_1 = mass[1]
dlina_2 = mass[2]
visot_2 = mass[3]
temp = max(dlina_1, dlina_2)
temp_1 = visot_1 + visot_2
square = (temp + 2) * (temp_1 + 2)
square_min = temp * temp_1
print(square - square_min)


__author__ = 'NIORLYS'
[w1, h1, w2, h2] = list(map(int, input().split()))
if w1 == w2:
	print(2 * (h1 + h2 + 2) + 2 * w1)
else:
	print(2 * (h1 + h2 + 2) + 2 * w1)


def solve():
	(w2, h2, w1, h1) = map(int, input().split())
	ans = h1 * 2 + h2 * 2 + w2 * 2 + 4
	print(ans)
solve()


a = input().split(' ')
w1 = int(a[0])
h1 = int(a[1])
w2 = int(a[2])
h2 = int(a[3])
sum = (max(w1, w2) + 2) * (h1 + h2 + 2)
if w1 > w2:
	sum -= (w1 - w2) * h2
else:
	sum -= (w2 - w1) * h1
sum -= w1 * h1
sum -= w2 * h2
print(sum)


import sys
(w1, h1, w2, h2) = list(map(int, input().split(' ')))
count = (w1 + 2) * (h1 + 1) - w1 * h1 + (w2 + 2) * (h2 + 1) - w2 * h2 + max(w1, w2) - min(w1, w2)
print(count)
pass


a = input()
l = []
for i in a.split(' '):
	l.append(int(i))
a1 = l[0] * l[1]
a2 = l[2] * l[3]
diff = (l[0] - l[2]) * l[3]
if l[2] == l[0]:
	total = (l[1] + l[3] + 2) * (l[0] + 2) - (a1 + a2)
else:
	total = (l[1] + l[3] + 2) * (l[0] + 2) - (a1 + a2) - diff
print(total)


(w1, h1, w2, h2) = list(map(int, input().split()))
if w1 == w2:
	print(w1 + w2 + 2 * (h1 + h2) + 4)
elif w1 > w2:
	print(w1 + w2 + 2 * (h1 + h2) + (w1 - w2 - 1) + 5)
else:
	print(w1 + w2 + 2 * (h1 + h2) + (w2 - w1 - 1) + 5)


(w1, h1, w2, h2) = [int(i) for i in input().split()]
sum1 = 0
sum1 = w1 + w2 + abs(w1 - w2) + 4
sum1 = sum1 + (h1 + h2) * 2
print(sum1)


(w1, h1, w2, h2) = map(int, input().split())
n = (w1 + 2) * 2 + h1 * 2 - w2 + (h2 - 1) * 2 + w2 + 2
print(n)


import sys

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(w1, h1, w2, h2) = inpl()
print(2 * (w1 + w2 + h1 + h2) + 8 - 2 * (w2 + 2))


def main():
	arr = list(map(int, input().split()))
	if arr[0] == arr[2]:
		print(2 * (arr[1] + arr[3]) + 2 * arr[0] + 4)
	else:
		print(arr[1] + arr[3] + 4 + arr[0] + arr[1] + arr[0] + arr[3])
main()


(w1, h1, w2, h2) = map(int, input().split())
g = 2 * h1 + 2 * h2 + 2 * w1 + 4
print(g)


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
(w1, h1, w2, h2) = mi()
s = w1 + w2 + 4 + h1 + h2
if w1 > w2:
	s += h2 + (w1 - w2) + h1
if w2 > w1:
	s += h1 + (w2 - w1) + h2
if w1 == w2:
	s += h1 + h2
print(s)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
(w1, h1, w2, h2) = listIn()
print(w1 + w2 + 4 + (h1 + h2) * 2 + (w1 - w2))


(w1, h1, w2, h2) = map(int, input().split())
first = 2 * w1 + 2 * h1 + 4
second = 2 * w2 + 2 * h2 + 4
first_inter_body = w2
second_inter_body = min(w1, w2 + 1)
inter_border = 4 if w1 == w2 else 3
ans = first + second - first_inter_body - second_inter_body - inter_border
print(ans)


(w, h, W, H) = map(int, input().split())
print(2 * h + 2 * H + 4 + w + W + abs(w - W))


(x1, y1, x2, y2) = [int(i) for i in input().split()]
c = 2 * (y1 + y2) + x1 + x2 + 4 + (x1 - x2)
print(c)


(n, m, a, b) = map(int, input().split())
print(2 * (n + m) + 2 * (a + b) + 4 - 2 * min(n, a))


(x1, y1, x2, y2) = map(int, input().split())
ans = 2 * (y1 + y2 + 2)
ans += 2 * max(x1, x2)
print(ans)


y = list(map(int, input().split()))
(w1, h1, w2, h2) = (y[0], y[1], y[2], y[3])
x = w1 + 4 + w2 + 2 * (h1 + h2) + (w1 - w2)
print(x)


(w, h, x, i) = map(int, input().split())
print((h + i + 2) * 2 + min(w, x) * 2 + abs(w - x) * 2)


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	(w1, h1, w2, h2) = read_ints()
	print(2 * w1 + 2 * (h1 + h2) + 4)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


a = list(map(int, input().split()))
a1 = (a[0] + 2) * (a[1] + 1) - a[0] * a[1]
a2 = (a[2] + 2) * (a[3] + 1) - a[2] * a[3]
print(a2 + a1 - (a[2] - a[0]))


(w, h, e, j) = (int(i) for i in input().split())
(p1, p2) = ((w + 2) * (h + 2) - w * h, (e + 2) * (j + 2) - e * j)
print(p1 + p2 - (min(w, e) + 2) * 2 if w != e else p1 + p2 - (w + 2) * 2)


(a, b, c, d) = map(int, input().split())
x = 2 * (b + d) + a + c + 4 + a - c
print(x)


(x1, y1, x2, y2) = map(int, input().split())
c = 2 + 2 * y1 + x1
d = 2 + 2 * y2 + x2
e = abs(x2 - x1)
print(c + d + e)


import sys
line = sys.stdin.readline().strip()
(w1, h1, w2, h2) = map(int, line.split())
print((w1 + h1 + h2 + 2) * 2)


(w1, h1, w2, h2) = input().split()
c = int(w1) + int(w2)
c += 2 * (int(h1) + int(h2))
c += 4
c += abs(int(w1) - int(w2))
print(c)


x = input()
xx = x.split()
w1 = int(xx[0])
h1 = int(xx[1])
w2 = int(xx[2])
h2 = int(xx[3])
g = 2 * h1 + 2 * w1 + 4 + 2 * h2
print(g)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
area = 2 * (w1 + h1 + w2 + h2) - 2 * min(w1, w2) + 4
print(area)


(w1, h1, w2, h2) = map(int, input().split())
p1 = 2 * (w1 + 1) + 2 * (h1 + 1)
p2 = 2 * (w2 + 1) + 2 * (h2 + 1)
print(p1 + p2 - min(w1, w2) - min(w1, w2) - 4)


from sys import stdin, stdout
from math import sqrt, pi, acos, gcd, atan2, cos, sin

def sqr(a):
	return a * a

def dist(a, b):
	return sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]))

def s_dist(a, b):
	return sqr(a[0] - b[0]) + sqr(a[1] - b[1])

def trans(p, al):
	return (p[0] * cos(al) + p[1] * sin(al), -p[0] * sin(al) + p[1] * cos(al))
(w1, h1, w2, h2) = map(int, stdin.readline().split())
if w1 == w2:
	stdout.write(str(w1 + w2 + h1 + h2 + 4 + h1 + h2))
else:
	stdout.write(str(w1 + w2 + h1 + h2 + 5 + h1 + h2 + (w1 - w2 - 1)))


(w1, h1, w2, h2) = list(map(int, input().split()))
result = 0
if w1 > w2:
	result += 5
	result += 2 * h1 + 2 * h2
	result += w1 + w2 + (w1 - w2 - 1)
else:
	result += 4
	result += 2 * w1
	result += 2 * h1 + 2 * h2
print(result)


l = input()
a = list(map(int, l.split(' ')))
connt = (a[1] + a[3] + 2) * (a[0] + 2) - (a[1] + a[3]) * a[0]
print(connt)


(a, b, c, d) = list(map(int, input().split()))
p = (a + 2) * (b + d + 2) - (a - c) * d - a * b - c * d
print(p)


def f(w1, h1, w2, h2):
	return (w1 + h1 + h2) * 2 + 4
input_data = map(lambda _: int(_), input().split(' '))
print(f(*input_data))


(a, b, c, d) = map(int, input().split())
ans = 2 * d + 2 * a + 2 * b + 4
print(ans)


inp = input().strip().split(' ')
w1 = int(inp[0])
h1 = int(inp[1])
w2 = int(inp[2])
h2 = int(inp[3])
area1 = (h1 + 2) * (w1 + 2) - h1 * w1 - w2
area2 = h2 * (w2 + 2) - (h2 - 1) * w2
print(area1 + area2)


(n1, k1, n2, k2) = map(int, input().split())
print(2 * n1 + 2 * (k1 + k2 + 2))


(x1, y1, x2, y2) = [int(x) for x in input().split()]
answer = 0
areaBot = x1 + 2 * y1 + 2 + x1 - x2
areaTop = x2 + 2 * y2 + 2
print(areaBot + areaTop)


(w1, h1, w2, h2) = map(int, input().split())
ar = h1 * w1 + h2 * w2
are1 = (w1 + 2) * (h1 + 1)
are2 = (w2 + 2) * (h2 + 1)
c = w1 - w2
print(c + are1 + are2 - ar)


def main():
	datos = list(map(int, input().split()))
	w1 = datos[0]
	h1 = datos[1]
	w2 = datos[2]
	h2 = datos[3]
	area1 = w1 * 2 + (2 + h1) * 2 - w2
	area2 = h2 + h2 + w2
	print(area1 + area2)
main()


(w1, h1, w2, h2) = map(int, input().split())
Am = w1 * (h1 + h2)
k = w1 - w2
AM = (2 + w1) * (h1 + h2 + 2)
N = AM - Am
print(N)


pars = list(map(int, input().split()))
print(pars[0] + 2 + pars[1] * 2 + pars[3] * 2 + 2 + pars[2] + (max(pars[2], pars[0]) - min(pars[2], pars[0])))


from math import *
(w1, h1, w2, h2) = map(int, input().split())
print((h1 + h2) * 2 + (w1 - w2) + w1 + w2 + 4)


(wa, ha, wb, hb) = map(int, input().split())
blocks = 0
blocks = wa + 2 * ha + wb + 2 * hb + 4 + (wa - wb)
print(blocks)


(w1, h1, w2, h2) = list(map(int, input().split()))
ans = 2 * (w1 + h1) + 2 * (w2 + h2) + 4
ans -= min(w1, w2) * 2
print(ans)


(w1, h1, w2, h2) = map(int, input().split(' '))
res = (h1 + h2 + 2) * (w1 + 2) - w1 * h1 - w2 * h2 - h2 * (w1 - w2)
print(res)


a = [int(x) for x in input().split(' ')]
b = 2 * (a[1] + a[3]) + a[0] + a[2] + abs(a[0] - a[2]) + 4
print(b)


(w1, h1, w2, h2) = map(int, input().split())
h = h1 + h2
p = w1 * h
q = (w1 + 2) * (h + 2)
print(q - p)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
(w1, h1, w2, h2) = mapin()
ans = 2 * (h1 + h2) + 2 * w1 + 4
print(ans)


a = list(map(int, input().split()))
print(2 * (a[0] + a[1] + a[3]) + 4)


(w1, h1, w2, h2) = [int(s) for s in input().split(' ')]
green = 4 + w1 + w2 + 2 * h1 + 2 * h2 + abs(w1 - w2)
print(green)


x = list(map(int, input('').split()))
print(4 + 2 * x[0] + 2 * (x[1] + x[3]))


(w1, h1, w2, h2) = map(int, input().split())
import math
ans = (w1 + 2) * (h1 + 2) + (w2 + 2) * (h2 + 2) - 2 * min(w1 + 2, w2 + 2) - w1 * h1 - w2 * h2
print(ans)


(w1, h1, w2, h2) = input().split()
w1 = int(w1)
h1 = int(h1)
w2 = int(w2)
h2 = int(h2)
a = h1 * 2 + h2 * 2 + (w1 + 2) + (w2 + 2) + (w1 - w2)
print(a)


import sys
inn = lambda : input().strip()
(garo1, sero1, garo2, sero2) = map(int, inn().split(' '))
print((garo1 + 2) * 2 + (sero1 + sero2 + 2) * 2 - 4)


(w1, h1, w2, h2) = list(map(int, input().split()))
ver = 2 * (h1 + h2)
hor = w1 + w2 + (w1 - w2)
print(hor + ver + 4)


import sys
x = sys.stdin.readline()
x = x.split(' ')
w1 = int(x[0])
h1 = int(x[1])
w2 = int(x[2])
h2 = int(x[3])
z = h1 + h2 + 2 + w1 + w2 + h1 + 2 + w1 - w2 + h2
print(z)


f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
(w1, h1, w2, h2) = f()
print((h1 + h2 + 2) * 2 + max(w1, w2) * 2)


def ans(w1, h1, w2, h2):
	cnt = 0
	if w1 >= w2:
		cnt += (w1 + 2) * (h1 + 2) - w1 * h1
		h2 -= 1
		cnt += 3 + h2 * 2
	else:
		cnt += (w2 + 2) * (h2 + 2) - w2 * h2
		h1 -= 1
		cnt += 3 + h1 * 2
	return cnt - 1
arr = list(map(int, input().strip().split()))
print(ans(arr[0], arr[1], arr[2], arr[3]))


def solution(l1):
	rect2 = l1[2] + l1[3]
	rect1 = l1[0] + l1[2]
	bottom = l1[0] + 2 * l1[1] + 2
	top = l1[2] + 2 * l1[3] + 2
	hang = abs(l1[0] - l1[2])
	return top + bottom + hang

def answer():
	l1 = [int(x) for x in input().split()]
	print(solution(l1))
answer()


(w1, h1, w2, h2) = map(int, input().split())
a1 = (w1 + 2) * (h1 + 2) - w1 * h1
a2 = (w2 + 2) * (h2 + 2) - w2 * h2
print(a1 + a2 - 2 * (w2 + 2))


(a, b, c, d) = [int(i) for i in input().split()]
print(2 * (b + d) + 4 + a + c + (a - c))


(w1, h1, w2, h2) = map(int, input().split())
free = 2 * (h1 + h2 + w1 + 2)
print(free)


a = list(map(int, input().split()))
area = 0
area += (a[0] + 2) * (a[1] + 2) - (a[0] + 2) - a[0] * a[1]
area += (a[2] + 2) * (a[3] + 2) - (a[2] + 2) - a[2] * a[3]
area += abs(a[0] - a[2])
print(area)


(w, x, y, z) = map(int, input().split())
print(2 * (w + x) + 4 + (2 * (y + z) + 4) - (min(w, y) * 2 + 4))


(a, b, c, d) = map(int, input().split())
print(4 + a * 2 + b * 2 - c + (d - 1) * 2 + 2 + c)


def main():
	(w1, h1, w2, h2) = map(int, input().split())
	s = max(w1, w2)
	u = h1 + h2
	print(2 * (s + u) + 4)
main()


import math as mt
import itertools as it
import functools as ft
import random as rnd
stdin = lambda type_='int', sep=' ': list(map(eval(type_), input().split(sep)))
joint = lambda sep=' ', *args: sep.join((str(i) if type(i) != list else sep.join(map(str, i)) for i in args))
(w1, h1, w2, h2) = stdin()
print(2 * (h1 + h2) + w1 + w2 + 4 + max(w1 - w2, 0))


import sys
try:
	sys.stdin = open('in.in', 'r')
	sys.stdout = open('out.out', 'w')
except:
	pass
(w1, h1, w2, h2) = map(int, input().split())
if w1 == w2:
	print(h1 + h1 + h2 + h2 + w1 + w2 + 4)
else:
	print(h2 + h2 + w2 + 2 + h1 + h1 + w1 + 2 + w1 - w2)


str = input()
(w1, h1, w2, h2) = str.split()
w1 = int(w1)
h1 = int(h1)
w2 = int(w2)
h2 = int(h2)
print(w1 + 2 * h1 + 2 + max(w1, w2) - min(w1, w2) + h2 + w2 + 1 + h2 - 1 + 2)


(w1, h1, w2, h2) = [int(j) for j in input().split()]
print(2 * (w1 + h1 + h2) + 4)


ship = [int(x) for x in input().split()]
squares = ship[0] + ship[2] + 4 + (ship[1] + ship[3]) * 2 + (ship[0] - ship[2])
print(squares)


(w1, h1, w2, h2) = [int(i) for i in input().split()]
area = w1 + 2 + 2 * h1 + 1
area += w2 + 2 + 2 * h2
if w1 > w2:
	area += w1 - w2 - 1
else:
	area -= 1
print(area)


from sys import stdin, stdout
(w1, h1, w2, h2) = [int(x) for x in stdin.readline().rstrip().split()]
green = 2 * w1 + 2 * (h1 + h2) + 4
print(green)


(w1, h1, w2, h2) = map(int, input().split())
s = w1 + w2 + 2 * h1 + 2 * h2 + 4
lol = abs(w1 - w2)
print(s + lol)


(w1, h1, w2, h2) = map(int, input().split())
cell_1 = 2 * (w1 + h1 + 2)
cell_2 = 2 * (w2 + h2 + 2)
w_cell_1 = w1 + 2
w_cell_2 = w2 + 2
print(cell_1 + cell_2 - 2 * min(w_cell_1, w_cell_2))


(w1, h1, w2, h2) = map(int, input().split())
print(2 * max(w1 + 2, w2 + 2) - w1 - w2 + (2 * (h1 - 1) + w1 + 2) + (2 * (h2 - 1) + w2 + 2))


(w1, h1, w2, h2) = [int(a) for a in input().split(' ')]
print(2 * (w1 + h1) + 6 + 2 * (h2 - 1))


z = list(map(int, input().split()))
tinggi = z[1] + z[3]
count = 0
count += (tinggi + 2) * 2
print(count + z[0] + z[2] + abs(z[0] - z[2]))


(w1, h1, w2, h2) = map(int, input().split(' '))
print(str((h1 + h2 + 2) * 2 + w1 * 2))


(a, b, c, d) = map(int, input().split())
print(2 * (b + d + 2) + a + c + max(a, c) - min(a, c))


n = input().split(' ')
print(int(n[0]) + int(n[2]) + 2 * (int(n[1]) + int(n[3])) + abs(int(n[0]) - int(n[2])) + 4)


(w1, h1, w2, h2) = map(int, input().split())
a1 = w1 * h1
a2 = w2 * h2
a = a1 + a2
b1 = (w1 + 2) * (h1 + 2)
b2 = (w2 + 2) * (h2 + 1)
b = b1 + b2
ans = b - a - (w2 + 2)
print(ans)


(a, b, c, d) = map(int, input().split())
answer = b * 2 + d * 2 + 4 + a + c + (a - c)
print(answer)


(w1, h1, w2, h2) = list(map(int, input().split()))
kol = (w1 + 2) * 2 + h1 * 2 + (w2 + 2) * 2 + h2 * 2 - (min(w1, w2) + 2) * 2
print(kol)


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
from fractions import Fraction

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)
(a, b, c, d) = mi()
x = 2 * (b + d) + 4
x += a + c + abs(a - c)
print(x)


(w1, h1, w2, h2) = map(int, input().split())
if w1 >= w2:
	p1 = (w1 + h1 + 2) * 2
	p2 = (w2 + h2 + 2) * 2
	p = p1 + p2 - 2 * (w2 + 2)
	print(p)


(x, y, z, w) = map(int, input().split())
t = x + 2
s = y + w + 2
print(s * t - x * (y + w))


(p, q, r, s) = map(int, input().split())
print(2 * (p + q + s + 2))


(w1, h1, w2, h2) = [int(s) for s in input().split(' ')]
ans = w1 + h1 * 2 + 2
ans += w2 + h2 * 2 + 2
if w1 != w2:
	ans += abs(w1 - w2)
print(ans)


a = [x for x in input().split(' ')]
w1 = a[0]
h1 = a[1]
w2 = a[2]
h2 = a[3]
print(int(h1) + int(h2) + 2 + (int(w1) + int(w2) + 2) + int(h1) + int(h2) + abs(int(w1) - int(w2)))


(w1, h1, w2, h2) = map(int, input().split())
ver = (h1 + h2 + 2) * 2 + min(w1, w2) * 2 + abs(w2 - w1) * 2
print(ver)


import math
(w1, h1, w2, h2) = [int(x) for x in input().split()]
answer = (w1 + 2) * (h1 + 2)
answer += (w2 + 2) * (h2 + 2)
m = w1 if w1 < w2 else w2
answer -= 2 * (m + 2) + w1 * h1 + w2 * h2
print(answer)


from math import fabs
w1 = input().split()
h1 = int(w1[1])
w2 = int(w1[2])
h2 = int(w1[3])
w1 = int(w1[0])
sum = h1 + h2 + 2
sum *= 2
sum += w1 + w2
sum += fabs(w1 - w2)
print(int(sum))


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	(w1, h1, w2, h2) = map(int, sys.stdin.readline().split(' '))
	print(2 * (h1 + h2 + w1) + 4)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


n = input()
n = n.split()
w1 = int(n[0])
h1 = int(n[1])
w2 = int(n[2])
h2 = int(n[3])
ans = w1 + 2 * h1 + 2 * h2 + w2 + 4 + w1 - w2
print(ans)


(w, h, ww, hh) = [int(i) for i in input().split()]
print((w + h + hh + 2) * 2)


a = [int(q) for q in input().strip().split()]
print(4 + (a[0] + a[1] + a[3]) * 2)


(p1, q1, p2, q2) = [int(x) for x in input().split()]
print(2 * p1 + 2 * (q1 + q2) + 4)


(a, b, c, d) = list(map(int, input().strip().split()))
print(a + 2 + 2 * b + c + 2 + d * 2 + a - c)


a = list(map(int, input().split()))
res = a[0] + a[1] * 2 + 2 + a[2] + a[3] * 2 + 2 + (a[0] - a[2])
print(res)


(w1, h1, _, h2) = map(int, input().split())
print(2 * (w1 + h1 + h2 + 2))


(w1, h1, w2, h2) = map(int, input().split())
x = w1 + 1
y = h1 + h2 + 1
print(2 * (x + y))


from sys import stdin
(w1, h1, w2, h2) = list(map(int, stdin.readline().split()))
height = h1 + h2
width = w1
area = (height + 2) * (width + 2)
area -= h1 * w1
area -= h2 * w2
area -= h2 * (w1 - w2)
print(area)


(w1, h1, w2, h2) = map(int, input().split())
lower1 = h1 * 2 + w1 + 2
lower2 = h2 * 2 + w2 + 2
if w1 > w2:
	print(lower1 + lower2 + w1 - w2)
else:
	print(lower1 + lower2 + w2 - w1)


def main():
	[w1, h1, w2, h2] = [int(_) for _ in input().split()]
	marked = w1 + 2 + h1 * 2 + h2 * 2 + (w2 + 2) + (w1 - w2)
	print(marked)
main()


(w1, h1, w2, h2) = map(int, input().split())
k = 0
if w1 > w2:
	k = w1 - w2
elif w1 < w2:
	k = w2 - w1
elif w1 == w2:
	k = 0
a = (h1 + h2) * 2 + 4 + w1 + w2 + k
print(a)


(w, h, nw, nh) = map(int, input().split())
ans = w * 2 + h * 2 + 4
ans -= nw
ans += nw * 2 + (nh - 1) * 2 + 4
ans -= nw + 2
print(ans)


vvod = input()
(w1, h1, w2, h2) = vvod.split()
w1 = int(w1)
h1 = int(h1)
w2 = int(w2)
h2 = int(h2)
if w1 < w2:
	print('Введите правильные данные')
elif w1 == w2:
	res = w1 + 2 * h1 + 2 * h2 + w2 + 4
	print(res)
elif w1 - w2 > 1:
	res2 = 2 * w1 + 2 * h1 + 2 * h2 + 4
	print(res2)
else:
	res1 = w1 + 2 * h1 + 2 * h2 + w2 + 5
	print(res1)


from collections import defaultdict
(w1, h1, w2, h2) = list(map(int, input().split()))
h = h1 + h2
w = w1
area = (h + 2) * (w + 2)
area -= h1 * w1
area -= h2 * w2
area -= h2 * (w1 - w2)
print(area)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	(w1, h1, w2, h2) = [int(x) for x in stdin.readline().split()]
	mw = min(w1, w2)
	res = 4 + 2 * (w1 + h1) + (4 + 2 * (w2 + h2)) - 2 * (mw + 2)
	stdout.write(str(res))
	return 0
main()


input = input().split(' ')
total_area = (int(input[0]) + 2) * (int(input[1]) + int(input[3]) + 2)
output = total_area - int(input[0]) * (int(input[1]) + int(input[3]))
print(output)


(w1, h1, w2, h2) = [int(s) for s in input().split(' ')]
print((h1 + h2 + w1 + 2) * 2)


(w1, h1, w2, h2) = map(int, input().split())
if w2 > w1:
	res = w1 + 1 + h1 + h2 + 1 + w2 + 1 + h2 + (w1 - w2) + h1 + 1
else:
	res = (w1 + h1 + h2) * 2 + 4
print(res)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(a, b, c, d) = LI()
	ans = (a + 2) * (b + 2) + (c + 2) * (d + 2)
	ans -= a * b
	ans -= c * d
	mn = min(a, c)
	ans -= 2 * (mn + 2)
	return ans
print(main())


m = [int(x) for x in input().split()]
w1 = m[0]
h1 = m[1]
w2 = m[2]
h2 = m[3]
print(2 * w1 + 2 * h1 + 2 * h2 + 4)


(w1, h1, w2, h2) = [int(x) for x in input().split()]
maxW = max(w1, w2)
maxH = h1 + h2
totalArea = maxW * 2 + maxH * 2 + 4
print(str(totalArea))


class CodeforcesTask1131ASolution:

	def __init__(self):
		self.result = ''
		self.w_h_w_h = []

	def read_input(self):
		self.w_h_w_h = [int(x) for x in input().split(' ')]

	def process_task(self):
		w = max(self.w_h_w_h[0], self.w_h_w_h[2])
		h = self.w_h_w_h[1] + self.w_h_w_h[3]
		res = w * 2 + h * 2 + 4
		self.result = str(res)

	def get_result(self):
		return self.result
Solution = CodeforcesTask1131ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


w = input()
x = w.split()
for i in range(4):
	x[i] = int(x[i])
a = 4
a += 2 * x[1]
a += 2 * x[3]
a += 2 * max(x[0], x[2])
print(a)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
(a, b, c, d) = ml()
ans = 2 * (a + b) + 2 * (c + d)
ans -= 2 * min(a, c) - 4
print(ans)


(w1, h1, w2, h2) = list(map(int, input().split()))
(x, y) = (h1 + h2, max(w1, w2))
print(2 * x + 2 * y + 4)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(w1, h1, w2, h2) = LI()
	r = w1 + w2 + (h1 + h2) * 2 + 4 + abs(w1 - w2)
	return r
print(main())


i = input().split()
a = int(i[0])
b = int(i[1])
c = int(i[2])
d = int(i[3])
e = 2 * d + c + 2
f = a + 2 * b + 2
g = a - c
if g > 0:
	g = g
else:
	g = 0
print(e + f + g)


(w1, h1, w2, h2) = map(int, input().split())
cellnum = 0
cellnum += h1 + h2 + 2
cellnum += w1 + w2
cellnum += h1 + h2 + 2
cellnum += abs(w2 - w1)
print(cellnum)


inputs = list(map(int, input().split()))
w1 = inputs[0]
h1 = inputs[1]
w2 = inputs[2]
h2 = inputs[3]
out = 2 * (h1 + h2) + w1 + w2 + (w1 - w2) + 4
print(out)


y = input()
x = y.split()
x = [int(i) for i in x]
print(2 * x[0] + 2 * (x[1] + x[3]) + 4)


import sys
(w1, h1, w2, h2) = map(int, sys.stdin.readline().split())
if w1 >= w2:
	neww1 = w1 + 2
	newh1 = h1 + 2
	neww2 = w2 + 2
	newh2 = h2
	ans = neww1 * newh1 + neww2 * newh2 - (w1 * h1 + w2 * h2)
else:
	neww2 = w2 + 2
	newh2 = h2 + 2
	neww1 = w1 + 2
	newh1 = h1
	ans = neww1 * newh1 + neww2 * newh2 - (w1 * h1 + w2 * h2)
print(ans)


(a, b, c, d) = map(int, input().split())
sum1 = b * 2 + a * 2 + 4
sum2 = c * 2 + d * 2 + 4
if a > c:
	print(sum1 + sum2 - (c * 2 + 4))
else:
	print(sum1 + sum2 - (a * 2 + 4))


(a, b, c, d) = [int(x) for x in input().split()]
if a == c:
	print(a + 2 * b + 2 + c + 2 * d + 2)
elif c < a:
	print(a + 2 * b + 2 + c + 2 * d + 2 + (a - c))
else:
	print(a + 2 * b + 2 + c + 2 * d + 2 + (c - a))


(w1, h1, w2, h2) = map(int, input().split())
print(h1 + 1 + w1 + h1 + 1 + h2 + 1 + w2 + h2 + 1 + abs(w1 - w2))


(w, h, v, g) = map(int, input().split())
if w < v:
	(w, h, v, g) = (v, g, w, h)
print(w + 2 + h * 2 + (w + 2 - v) + (g - 1) * 2 + (v + 2))


import sys
(w1, h1, w2, h2) = [int(i) for i in sys.stdin.readline().split(' ')]
print(2 * (w1 + h1 + h2) + 4)


l = list(map(int, input().split()))
cubes = 0
w1 = l[0]
h1 = l[1]
w2 = l[2]
h2 = l[3]
cubes = (h1 + h2 + 2) * 2 + w1 * 2
print(cubes)


from collections import namedtuple
sizes = input()
sizes = sizes.split(' ')
sizes = [int(x) for x in sizes]
Rect = namedtuple('Rect', ['x', 'y', 'w', 'h'])
(w1, h1, w2, h2) = sizes
(x1, y1) = (1, 1)
(x2, y2) = (1, y1 + h1)

def get_intersection_area(r1, r2):
	dx = min(r1.x + r1.w, r2.x + r2.w) - max(r1.x, r2.x)
	dy = min(r1.y + r1.h, r2.y + r2.h) - max(r1.y, r2.y)
	return dx * dy
r1 = Rect(x1 - 1, y1 - 1, w1 + 2, h1 + 2)
r2 = Rect(x2 - 1, y2 - 1, w2 + 2, h2 + 2)
padded_total = r1.w * r1.h + r2.w * r2.h
intersection = get_intersection_area(r1, r2)
non_padded_total = w1 * h1 + w2 * h2
print(padded_total - intersection - non_padded_total)


def fn(w1, h1, w2, h2):
	edge = w1 - w2
	perim = h1 + h2 + w2 + w1 + h2 + h1 + edge + 4
	return perim
(w1, h1, w2, h2) = [int(x) for x in input().split()]
print(fn(w1, h1, w2, h2))


from sys import stdin

def main():
	HW = list(map(int, input().split()))
	w = max(HW[0], HW[2])
	h = HW[1] + HW[3]
	print((w + 1) * 2 + (h + 1) * 2)
input = lambda : stdin.readline()
main()


(w1, h1, w2, h2) = [int(i) for i in input().split(' ')]

def he(w1, h1, w2, h2):
	if w1 >= w2:
		res = 2 * h1 + w1 + 2
		res += 2 * h2 + w2 + 2
		res += w1 - w2
	else:
		res = he(w2, h1, w1, h2)
	return res
print(he(w1, h1, w2, h2))


(a, b, c, d) = map(int, input().split())
s1 = 2 * (a + b + 2)
s2 = 2 * (c + d + 2)
print(s1 + s2 - 2 * (min(a, c) + 2))


str_in = input()
num = [int(n) for n in str_in.split()]
w1 = num[0]
h1 = num[1]
w2 = num[2]
h2 = num[3]
if int(w1) == int(w2):
	a1 = (int(w1) + 2) * (int(h1) + 1)
	a2 = (int(w2) + 2) * (int(h2) + 1)
	answer = a1 + a2 - int(w1) * int(h1) - int(w2) * int(h2)
else:
	a1 = (int(w1) + 2) * (int(h1) + 2)
	a2 = (int(w2) + 2) * int(h2)
	answer = a1 + a2 - int(w1) * int(h1) - int(w2) * int(h2)
print(answer)


(w1, h1, w2, h2) = map(int, input().split())
c1 = 2 * w1 + 2 * h1 + 4
c2 = 2 * w2 + 2 * h2 + 4
d = 2 * w2 + 4
print(c1 + c2 - d)


(w1, h1, w2, h2) = map(int, input().split())
while True:
	if w1 >= w2:
		a = 2 * (w1 + 2) + 2 * h1 + 2 + 2 * (h2 - 1)
		print(a)
		break
	else:
		(w1, w2) = (w2, w1)
		(h1, h2) = (h2, h1)


(w1, h1, w2, h2) = map(int, input().split())
g = (h1 + h2) * 2
g += min(w1, w2) + 2
g += max(w1, w2) + 2
g += w1 - w2
print(g)


(x1, y1, x2, y2) = list(map(int, input().split()))
result = (x1 + y1) * 2 + 4
result += (x2 + y2) * 2 + 4
min1 = min(x1, x2)
result -= min1 + 2
result -= min1
result -= 2
print(result)


(w1, h1, w2, h2) = map(int, input().split())
count = 0
if w1 == w2:
	count += 2 * (w1 + 2) + 2 * (h1 + h2)
else:
	count += 2 * (w1 + 2) + 2 * h1 + 2 * (h2 - 1) + 2
print(count)


from sys import stdin
from collections import Counter
from math import sqrt, factorial, log10, log, floor, ceil
from itertools import permutations, combinations, combinations_with_replacement
input = stdin.readline

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

def lis():
	return list(map(str, input().split()))

def mp():
	return map(int, input().split())

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

def inps():
	return str(input().strip())

def pr(n):
	return stdout.write(str(n) + '\n')
INF = float('inf')

def solve():
	(w1, h1, w2, h2) = mp()
	s1 = h1 * w1
	s2 = h2 * w2
	r = 0
	if w1 > w2:
		r = h2
	elif w2 > w1:
		r = h1
	s = (max(w1, w2) + 2) * (h1 + h2 + 2)
	s = s - s1 - s2 - r * abs(w2 - w1)
	print(s)
t = 1
for i in range(t):
	solve()


arr = [int(x) for x in input().split()]
w1 = arr[0]
h1 = arr[1]
w2 = arr[2]
h2 = arr[3]
if w1 == w2:
	print((w1 + 2) * 2 + (h1 + h2) * 2)
else:
	print(w1 + 2 + w2 + 2 + h2 + h1 + 1 + h1 + h2 + w1 - w2 - 1)


ent = input()
(w1, h1, w2, h2) = ent.split()
total = 2 * int(h1) + int(w1) + 2 + 2 * int(h2) + int(w2) + 2 + (int(w1) - int(w2))
print(total)


a = input()
parts = a.split()
w1 = int(parts[0])
h1 = int(parts[1])
w2 = int(parts[2])
h2 = int(parts[3])
if w1 != w2:
	x = h1 + h2 + w2 + h2 + w1 - w2 - 1 + h1 + w1 + 5
else:
	x = w1 * 2 + 4 + h1 + h2 + h1 + h2
print(x)


a = input().split()
s = max(int(a[0]), int(a[2]))
d = int(a[1]) + int(a[3])
print(2 * (s + d) + 4)


(w1, h1, w2, h2) = input().split()
(w1, h1, w2, h2) = (int(w1), int(h1), int(w2), int(h2))
print(w1 + 2 + (w2 + 2) + (h1 + h2) + (h1 + h2) + (max(w1, w2) - min(w1, w2)))


gi = lambda : list(map(int, input().split()))
(w, h, w1, h1) = gi()
print(h + h1 + 2 + w + 1 + w1 + 1 + h1 + w - w1 + h)


(w, h, a, b) = map(int, input().split())
q = h + b + 2
e = max(w, a) + 2
r = b if w >= a else h
print(q * e - abs(w - a) * r - w * h - a * b)


(w1, h1, w2, h2) = map(int, input().split())
a = [1, 1]
b = [w1, h1]
c = [1, h1 + 1]
d = [w2, h1 + h2]
s1 = b[0] - a[0] + 1 + 2 * (b[1] - a[1] + 1) + 2
s2 = d[0] - c[0] + 1 + 2 * (d[1] - c[1] + 1) + 2
if w1 == w2:
	print(s1 + s2)
else:
	sht = b[0] - a[0] + 1 - (d[0] - c[0] + 1) - 1
	print(s1 + s2 + 1 + sht)


(W1, H1, W2, H2) = [int(s) for s in input().split(' ')]
ans = (W1 + 2) * (H1 + 1) + (W2 + 2) * (H2 + 1) + (W1 - W2) - W1 * H1 - W2 * H2
print(ans)


import sys
import math, bisect
sys.setrecursionlimit(10 ** 6)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict

def I():
	return int(sys.stdin.readline())

def neo():
	return map(int, sys.stdin.readline().split())

def Neo():
	return list(map(int, sys.stdin.readline().split()))
(w1, h1, w2, h2) = neo()
h = h1 + h2
Ans = (h + 2) * (w1 + 2) - h * w1
print(Ans)


import sys
import math
lines = sys.stdin.read().splitlines()
(w1, h1, w2, h2) = [int(x) for x in lines[0].split()]

def getSurroundingArea(w, h):
	return 2 * w + 2 * h + 4
markedArea = getSurroundingArea(w1, h1) + getSurroundingArea(w2, h2) - 2 * (min(w1, w2) + 2)
print(markedArea)


l = list(map(int, input().split()))
print(sum(l) + l[1] + l[3] + 4 + l[0] - l[2])


(w1, h1, w2, h2) = map(int, input().split())
print(2 * w1 + 2 * h1 + 4 + (2 * (h2 - 1) + 2))


c = input().split(' ')
for i in range(len(c)):
	c[i] = int(c[i])
a = sum(c) - c[2] + 2
print(2 * a)


(a, b, c, d) = list(map(int, input().split(' ')))
sum = 0
sum += a + c + 2 * (b + 1) + 2 * (d + 1) + abs(a - c)
print(sum)