#include <bits/stdc++.h>
template <class T>
T _diff(T a, T b) {
  return (a < b ? b - a : a - b);
}
template <class T>
T _abs(T a) {
  return (a < 0 ? -a : a);
}
template <class T>
T _max(T a, T b) {
  return (a > b ? a : b);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T max3(T a, T b, T c) {
  return (_max(a, b) > c ? _max(a, b) : c);
}
template <class T>
T min3(T a, T b, T c) {
  return (_min(a, b) < c ? _min(a, b) : c);
}
template <class T>
T GCD(T a, T b) {
  a = _abs(a);
  b = _abs(b);
  T tmp;
  while (a % b) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  return b;
}
template <class T>
T LCM(T a, T b) {
  a = _abs(a);
  b = _abs(b);
  return (a / GCD(a, b)) * b;
}
using namespace std;
int x, y, xp, yp, xn, ynw, xl, yl, chk, si, t;
int main() {
  cin >> x >> y;
  xn = ynw = 0;
  chk = 1;
  xl = 0;
  yl = 0;
  t = 0;
  si = 1;
  int row = 1, col = 0;
  t = 0;
  while (1) {
    xp = xn;
    yp = ynw;
    if (chk == 1) {
      si = 1;
      chk++;
      xl++;
      yl++;
    } else if (chk == 2) {
      si = 1;
      chk++;
    } else if (chk == 3) {
      si = -1;
      chk++;
    } else if (chk == 4) {
      si = -1;
      chk = 1;
    }
    if (row) {
      xn = (si) * (xl);
      row = 0;
      col = 1;
    } else {
      ynw = (si) * (yl);
      row = 1;
      col = 0;
    }
    if (x == xn && x == xp) {
      if (si == 1 && y >= yp && y <= ynw)
        break;
      else if (si == -1 && y >= ynw && y <= yp)
        break;
    } else if (y == ynw && y == yp) {
      if (si == 1 && x >= xp && x <= xn)
        break;
      else if (si == -1 && x <= xp && x >= xn)
        break;
    }
    t++;
  }
  cout << t << endl;
  return 0;
}
