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