#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, sx = 1, sy = 0, ans = 0, it = 1;
  cin >> x >> y;
  if (x == 0 && y == 0) {
    cout << "0" << endl;
    return 0;
  }
  if (x == 1 && y == 0) {
    cout << "0" << endl;
    return 0;
  }
  while (1) {
    ans++;
    for (int i = 0; i < (2 * it) - 1; i++) {
      sy++;
      if (sx == x && sy == y) {
        cout << ans << endl;
        return 0;
      };
    }
    ans++;
    for (int i = 0; i < 2 * it; i++) {
      sx--;
      if (sx == x && sy == y) {
        cout << ans << endl;
        return 0;
      };
    }
    ans++;
    for (int i = 0; i < 2 * it; i++) {
      sy--;
      if (sx == x && sy == y) {
        cout << ans << endl;
        return 0;
      };
    }
    ans++;
    for (int i = 0; i < 2 * it; i++) {
      sx++;
      if (sx == x && sy == y) {
        cout << ans << endl;
        return 0;
      };
    }
    sx++;
    if (sx == x && sy == y) {
      cout << ans << endl;
      return 0;
    };
    it++;
  }
  cout << ans << endl;
  return 0;
}
