#include <bits/stdc++.h>
using namespace std;
int main() {
  int x1, y1;
  cin >> x1 >> y1;
  if (x1 == 0 && y1 == 0 || x1 == 1 && y1 == 0) {
    cout << "0"
         << "\n";
    return 0;
  }
  int k = 1, x = 1, y = 0, c = 0;
  while (k) {
    if (x == y && x < 0 && y < 0) {
      if (y == y1 && (x1 > x && x1 <= abs(x) + 1)) {
        cout << c + 1 << "\n";
        return 0;
      }
      x = abs(x) + 1;
      c++;
      continue;
    }
    if (x == y) {
      if (y == y1 && (x1 >= x * -1 && x1 < x)) {
        cout << c + 1 << "\n";
        return 0;
      }
      x *= -1;
      c++;
      continue;
    }
    if (x < y && abs(x) == abs(y)) {
      if (x == x1 && (y1 >= y * -1 && y1 < y)) {
        cout << c + 1 << "\n";
        return 0;
      }
      y *= -1;
      c++;
      continue;
    }
    if (abs(x) > abs(y)) {
      if (x == x1 && (y1 > y && y1 <= abs(y) + 1)) {
        cout << c + 1 << "\n";
        return 0;
      }
      y = abs(y) + 1;
      c++;
      continue;
    }
  }
  return 0;
}
