#include <bits/stdc++.h>
using namespace std;
int x, y;
int main() {
  scanf("%d%d", &x, &y);
  if (x == 0 && y == 0) {
    printf("0\n");
    return 0;
  }
  int cnt = 0;
  int cx = 0, cy = 0;
  while ((cx != x || cy != y) && abs(cx) <= 100 && abs(cy) <= 100) {
    int bcx = cx, bcy = cy;
    cnt++;
    if (cnt % 4 == 1) {
      cx *= -1;
      cx++;
      if (y == cy && x >= min(cx, bcx) && x <= max(cx, bcx)) break;
    } else if (cnt % 4 == 2) {
      cy *= -1;
      cy++;
      if (x == cx && y >= min(cy, bcy) && y <= max(cy, bcy)) break;
    } else if (cnt % 4 == 3) {
      cx *= -1;
      if (y == cy && x >= min(cx, bcx) && x <= max(cx, bcx)) break;
    } else {
      cy *= -1;
      if (x == cx && y >= min(cy, bcy) && y <= max(cy, bcy)) break;
    }
  }
  printf("%d\n", cnt - 1);
  return 0;
}
