#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int off = 101;
int x, y, cx, cy, d;
bool mark[300][300];
int res;
int main() {
  cin >> x >> y;
  if ((x == 0 && y == 0) || (x == 1 && y == 0)) {
    cout << 0;
    return 0;
  }
  mark[off][off] = true;
  mark[1 + off][off] = true;
  cx = 1;
  cy = 0;
  d = 1;
  while (cx != x || cy != y) {
    int nd = (d + 3) % 4;
    int nx = cx + dx[nd];
    int ny = cy + dy[nd];
    if (!mark[nx + off][ny + off]) {
      cx = nx;
      cy = ny;
      d = nd;
      ++res;
    } else {
      cx = cx + dx[d];
      cy = cy + dy[d];
    }
    mark[cx + off][cy + off] = true;
  }
  cout << res;
}
