#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  while (cin >> x >> y) {
    int i = 0, j = 0, dif = 1, h = 0, res = 0;
    while (true) {
      if (h == 0) {
        if (y == j && x >= i && x <= i + dif) break;
        i += dif;
      } else if (h == 1) {
        if (x == i && y >= j && y <= j + dif) break;
        j += dif;
        dif++;
      } else if (h == 2) {
        if (y == j && x <= i && x >= i - dif) break;
        i -= dif;
      } else {
        if (x == i && y <= j && y >= j - dif) break;
        j -= dif;
        dif++;
      }
      h = (h + 1) % 4;
      res++;
    }
    cout << res << endl;
  }
  return 0;
}
