# p = 0
#
#
# def f(d, a, t, target):
# global p
# if a == len(d):
# if t == target:
# p += 1
# return
# f(d, a + 1, t + d[a], target)
# f(d, a + 1, t - d[a], target)
#
#
# def solution(numbers, target):
# global p
# f(numbers, 1, numbers[0], target)
# f(numbers, 1, - numbers[0], target)
# answer = p
# return answer
#
#
# a = list(map(int, input().split()))
# ar = int(input())
# print(solution(a, ar))
# k = 0
#
#
# def f(d, a, v):
# global k
# if v[a] == 1:
# return
# v[a] = 1
# print(k, a, v)
# for i in range(len(d)):
# if i != a and d[a][i] == 1 and v[i] == 0:
# f(d, i, v)
# k += 1
#
#
# def solution(n, computers):
# global k
# answer = 0
# v = [0] * n
# for i in range(n):
# k = 0
# f(computers, i, v)
# if k != 0:
# answer += 1
# return answer
#
#
# a = int(input())
# sd = []
# for i in range(a):
# vw = list(map(int, input().split()))
# sd.append(vw)
# print(solution(a, sd))
# def solution(maps):
# n = len(maps)
# m = len(maps[0])
# answer = -2
# if maps[n - 1][m - 2] == 0 and maps[n - 2][m - 1] == 0:
# answer = - 1
# else:
# v = []
# for q in range(n):
# v1 = [0] * m
# v.append(v1)
# d = []
# f = 0
# d.append([0, 0])
# while True:
# x = d[f][0]
# y = d[f][1]
# f += 1
# print(x, y, v[x][y])
# if x == n - 1 and y == m - 1:
# answer = v[x][y]
# break
# if x < n - 1 and maps[x + 1][y] == 1 and (v[x + 1][y] > v[x][y] + 1 or v[x + 1][y] == 0):
# d.append([x + 1, y])
# v[x + 1][y] = v[x][y] + 1
#
# if y < m - 1 and maps[x][y + 1] == 1 and (v[x][y + 1] > v[x][y] + 1 or v[x][y + 1] == 0):
# d.append([x, y + 1])
# v[x][y + 1] = v[x][y] + 1
#
# if x > 0 and maps[x - 1][y] == 1 and (v[x - 1][y] > v[x][y] + 1or v[x - 1][y] == 0):
# d.append([x - 1, y])
# v[x - 1][y] = v[x][y] + 1
#
# if y > 0 and maps[x][y - 1] == 1 and (v[x][y - 1] > v[x][y] + 1 or v[x][y - 1] == 0):
# d.append([x, y - 1])
# v[x][y - 1] = v[x][y] + 1
# if len(d) <= f:
# break
# answer += 1
# return answer
#
#
# asd = []
# for i in range(3):
# sad = list(map(int, input().split()))
# asd.append(sad)
# print(solution(asd))
# k = 0
#
#
# def f(d, a, r, w, t):
# global k
# if a == w:
# k = t
# return
# r[a] = 1
# for i in range(len(d)):
# if i != a and d[i][a] == 1 and r[i] == 0:
# f(d, i, r, w, t + 1)
#
#
# def solution(begin, target, words):
# answer = 0
# n = len(words)
# w = 0
# p = 0
# for i in range(n):
# if words[i] == target:
# p = 1
# w = i
# break
# if p == 0:
# return answer
# d = []
# n = n + 1
# words.append(begin)
# for i in range(n):
# v = [0] * n
# d.append(v)
# for i in range(n):
# for j in range(n):
# if i == j:
# continue
# q = 0
# for h in range(len(words[i])):
# if words[i][h] != words[j][h]:
# q += 1
# if q > 1:
# break
# if q == 1:
# d[i][j] = 1
# r = [0] * n
# f(d, n - 1, r, w, 0)
# global k
# answer = k
# return answer
# import copy
#
# y = ['ZZZ']
#
#
# def f(n, t, d, a, an):
# global y
# for i in range(n):
# ans = copy.deepcopy(an)
# sd = copy.deepcopy(d)
# if t[i][0] == a and d[i] == 0:
# b = t[i][1]
# sd[i] = 1
# if len(y) > 1 and len(ans) > 1:
# if y[0:len(ans)] != ans and min(y[0:len(ans)], ans) == y[0:len(ans)]:
# return
# ans.append(b)
# f(n, t, sd, b, ans)
# if len(an) == n + 1:
# if len(y) == 1:
# y = an
# else:
# y = min(y, an)
#
#
# def solution(tickets):
# global y
# n = len(tickets)
# d = [0] * n
# qw = ["ICN"]
# f(n, tickets, d, 'ICN', qw)
# answer = y
# return answer
#
#
# ar = []
# for i in range(5):
# v = list(input().split())
# ar.append(v)
# print(solution(ar))
def solution(rectangle, characterX, characterY, itemX, itemY):
answer = 0
if len(rectangle) == 1:
a = characterX - itemX
b = characterX - itemY
answer = max(a, -a) + max(b, -b)
return answer