#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
};
int F[500][500];
int x, y;
void Init() {
  F[0 + 200][0 + 200] = 0;
  F[1 + 200][0 + 200] = 0;
  F[1 + 200][1 + 200] = 1;
  F[-1 + 200][1 + 200] = 2;
  F[-1 + 200][-1 + 200] = 3;
  for (int i = 2; i <= 110; i++)
    F[i + 200][i + 200] = F[i - 1 + 200][i - 1 + 200] + 4;
  for (int i = 2; i <= 110; i++)
    F[-i + 200][i + 200] = F[-i + 1 + 200][i - 1 + 200] + 4;
  for (int i = 2; i <= 110; i++)
    F[-i + 200][-i + 200] = F[-i + 1 + 200][-i + 1 + 200] + 4;
  for (int i = 2; i <= 110; i++)
    F[i + 200][-i + 1 + 200] = F[i - 1 + 200][-i + 2 + 200] + 4;
}
void thuchien() {
  if (x == 0 && y == 0) {
    cout << 0 << endl;
    return;
  }
  if (x == 1 && y == 0) {
    cout << 0 << endl;
    return;
  }
  if (y - x > 0 && x + y >= 0 && y > 0) {
    cout << F[-y + 200][y + 200] << endl;
    return;
  }
  if (x + y < 0 && y - x >= 0 && x < 0) {
    cout << F[x + 200][x + 200] << endl;
    return;
  }
  if (y - x < 0 && x + y - 1 <= 0 && y < 0) {
    cout << F[-y + 1 + 200][y + 200] << endl;
    return;
  }
  if (x + y - 1 > 0 && y - x <= 0 && x > 0) {
    cout << F[x + 200][x + 200] << endl;
    return;
  }
}
int main() {
  Init();
  while (cin >> x >> y) thuchien();
  return 0;
}
