#include <bits/stdc++.h>
using namespace std;
int dirx[4] = {1, 0, -1, 0};
int diry[4] = {0, 1, 0, -1};
int solve(int x, int y) {
  if (x == 0 && y == 0) return 0;
  int currx = 0, curry = 0, nextx, nexty;
  for (int i = 0; i < 100005; i++) {
    int idx = i % 4;
    int len = i / 2 + 1;
    nextx = currx + dirx[idx] * len;
    nexty = curry + diry[idx] * len;
    if (x >= min(currx, nextx) && x <= max(currx, nextx) &&
        y >= min(curry, nexty) && y <= max(curry, nexty)) {
      return i;
    }
    currx = nextx;
    curry = nexty;
  }
  return 0;
}
int main() {
  int x, y;
  cin >> x >> y;
  int ans = solve(x, y);
  cout << ans << endl;
  return 0;
}
