#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int p1 = 0, p2 = 0;
  int suma = 0;
  int c = 0, acu = 1;
  bool sw = true;
  if (x == 0 && y == 0) {
    cout << "0";
  } else {
    int XX = 0, YY = 0;
    bool SW = true;
    while (1) {
      if (SW) {
        SW = false;
        XX = 0;
        YY = 0;
      }
      c++;
      if (sw) {
        if (c == 1) {
          p1 += acu;
        } else {
          p2 += acu;
        }
      } else {
        if (c == 1) {
          p1 -= acu;
        } else {
          p2 -= acu;
        }
      }
      if (c == 2) {
        if (sw) {
          sw = false;
        } else {
          sw = true;
        }
        c = 0;
        acu++;
      }
      int a, b;
      if (YY == p2 && p2 == y) {
        a = max(XX, p1);
        b = min(XX, p1);
        if (x >= b && x <= a) {
          break;
        }
      } else {
        if (XX == p1 && p1 == x) {
          a = max(YY, p2);
          b = min(YY, p2);
          if (y >= b && y <= a) {
            break;
          }
        }
      }
      XX = p1;
      YY = p2;
      suma++;
    }
    cout << suma;
  }
  return 0;
}
