#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int l = 0, r = 0, u = 0, d = 0;
  int tx = 0, ty = 0, dir = 0, px = 0, py = 0, k = 0;
  while (true) {
    px = tx;
    py = ty;
    if (dir == 0) {
      r = tx = r + 1;
      dir = 1;
    } else if (dir == 1) {
      u = ty = u + 1;
      dir = 2;
    } else if (dir == 2) {
      l = tx = l - 1;
      dir = 3;
    } else if (dir == 3) {
      d = ty = d - 1;
      dir = 0;
    }
    int rx1 = min(tx, px), ry1 = min(ty, py);
    int rx2 = max(tx, px), ry2 = max(ty, py);
    if ((x >= rx1 && x <= rx2) && (y >= ry1 && y <= ry2)) {
      cout << k;
      return 0;
    }
    k++;
  }
}
