#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x = 0, y = 0, s = 0;
  cin >> a >> b;
  if (a == 0 && b == 0) {
    cout << "0";
    return 0;
  }
  for (int i = 1;; i++) {
    if (i % 2 != 0) {
      x = x + i;
      if (a <= x && a > x - i && b == y) {
        cout << s;
        return 0;
      }
      s++;
      y = y + i;
      if (a == x && b <= y && b > y - i) {
        cout << s << " ";
        return 0;
      }
      s++;
    } else {
      x = x - i;
      if (a >= x && a <= x + i && b == y) {
        cout << s;
        return 0;
      }
      s++;
      y = y - i;
      if (a == x && b >= y && b <= y + i) {
        cout << s;
        return 0;
      }
      s++;
    }
  }
}
