#include <bits/stdc++.h>
using namespace std;
const int N = 111111;
const int INF = int(1e9), mod = INF + 7;
int main() {
  int x, y;
  scanf("%d%d", &x, &y);
  int curx = 0, cury = 0;
  int cnt = 0, curlen = 1;
  bool go = 0;
  while (true) {
    if (x == curx && go) {
      int fin = cury + (cnt % 4 > 1 ? -curlen : curlen);
      if (cury <= y && y <= fin || cury >= y && y >= fin) {
        cout << cnt;
        return 0;
      }
    }
    if (y == cury && !go) {
      int fin = curx + (cnt % 4 > 1 ? -curlen : curlen);
      if (curx <= x && x <= fin || curx >= x && x >= fin) {
        cout << cnt;
        return 0;
      }
    }
    if (go) {
      if (cnt % 4 > 1)
        cury -= curlen;
      else
        cury += curlen;
    } else {
      if (cnt % 4 > 1)
        curx -= curlen;
      else
        curx += curlen;
    }
    if (++cnt % 2 == 0) curlen++;
    go ^= 1;
  }
  return 0;
}
