#include <bits/stdc++.h>
using namespace std;
int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
bool on_line(int x, int y, int x1, int y1, int x2, int y2) {
  if (x == x1) {
    if (y <= max(y1, y2) && y >= min(y1, y2)) {
      return true;
    }
  }
  if (y == y1) {
    if (x <= max(x1, x2) && x >= min(x1, x2)) {
      return true;
    }
  }
  return false;
}
int main() {
  int x, y;
  cin >> x >> y;
  int dis = 1;
  int sx = 0, sy = 0;
  for (int i(0), j(0);; ++i, j = (j + 1) % 4) {
    if (i && i % 2 == 0) dis++;
    if (on_line(x, y, sx, sy, sx + dis * dir[j][0], sy + dis * dir[j][1])) {
      cout << i << endl;
      return 0;
    }
    sx += dis * dir[j][0];
    sy += dis * dir[j][1];
  }
  return 0;
}
