#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  int x, y;
  cin >> x >> y;
  int px = 0;
  int py = 0;
  int L = 1;
  int step = 0;
  if (x == 0 and y == 0) {
    cout << 0 << endl;
    return 0;
  }
  int cont = 0;
  while (true) {
    int nx = px + dx[step] * L;
    int ny = py + dy[step] * L;
    if (nx == x) {
      if ((y >= py and y <= ny) or (y <= py and y >= ny)) break;
    }
    if (ny == y) {
      if ((x >= px and x <= nx) or (x <= px and x >= nx)) break;
    }
    cont++;
    px = nx;
    py = ny;
    if (step == 1 or step == 3) L++;
    step = (step + 1) % 4;
  }
  cout << cont << endl;
  return 0;
}
