#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int inf = 0x3f3f3f3f;
int fx[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int main() {
  int ex, ey;
  cin >> ex >> ey;
  if ((ex == 0 && ey == 0) || (ex == 1 && ey == 0)) {
    cout << 0;
    return 0;
  }
  int x = 1, y = 0, f = 1;
  int ans = 0;
  bool ok = 0;
  int cnt = 3;
  while (!ok) {
    for (int j = 1; !ok && j + j <= cnt; j++) {
      x += fx[f][0], y += fx[f][1];
      if (x == ex && y == ey) ok = 1;
    }
    cnt++;
    if (++f >= 4) f -= 4;
    ans++;
  }
  cout << ans << endl;
}
