#include <bits/stdc++.h>
using namespace std;
#define LL long long
int main() {
LL up = 2, right = 2, down = 1, left = 1;
LL a, b, x = 1, y = -1;
LL n = 6;
LL Cha = 0;
cin >> a >> b;
if (a == -1 && b == 0) {
cout << 1;
return 0;
}
if (a == -1 && b == 1) {
cout << 2;
return 0;
}
if (a == 0 && b == 1) {
cout << 3;
return 0;
}
if (a == 1 && b == 1) {
cout << 4;
return 0;
}
if (a == 1 && b == 0) {
cout << 5;
return 0;
}
if (a == 1 && b == -1) {
cout << 6;
return 0;
}
while (1) {
down += 2;
x -= down;
n += down;
if (b == y && a <= x && a >= x + n) {
Cha = a - x;
n = n - Cha;
goto l1;
}
left += 2;
y += left;
n += left;
if (x == a && b >= y - n && b <= y) {
Cha = y - b;
n = n - Cha;
goto l1;
}
up += 2;
x += up;
n += up;
if (y == b && a >= x - n && a <= x) {
Cha = x - a;
n = n - Cha;
goto l1;
}
right += 2;
y -= right;
n += right;
if (x == a && b >= y && b <= y + n) {
Cha = b - y;
n = n - Cha;
goto l1;
}
}
l1:
cout << n;
return 0;
}