#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
int main() {
  int x, y;
  cin >> x >> y;
  int answer = 0;
  int dx = 1, dy = 1, stx = 0, sty = 0;
  while (true) {
    if (y == sty &&
        ((stx <= x && x <= stx + dx) || (stx + dx <= x && x <= stx)))
      break;
    stx += dx;
    int zn = dx >= 0;
    dx = abs(dx) + 1;
    answer++;
    if (zn == 1) dx *= -1;
    if (x == stx & ((sty <= y && y <= sty + dy) || (sty + dy <= y && y <= sty)))
      break;
    answer++;
    sty += dy;
    zn = dy >= 0;
    dy = abs(dy) + 1;
    if (zn == 1) dy *= -1;
  }
  cout << answer;
  return 0;
}
