#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, n, n2;
  while (cin >> x >> y) {
    n = abs(x);
    n2 = abs(y);
    if ((x == 0 && y == 0) || (x == 1 && y == 0))
      cout << 0 << endl;
    else if (x >= y && y > 1 - x)
      cout << (1 + (x - 1) * 4) << endl;
    else if (y > x && y >= -x)
      cout << (4 * y - 2) << endl;
    else if (y >= x && y < -x)
      cout << (4 * (-x) - 1) << endl;
    else
      cout << (4 * (-y)) << endl;
  }
}
