#include <bits/stdc++.h>
using namespace std;
int main() {
  int rx, ry, x = 0, y = 0, cnt = 0, tx, ty;
  bool nv;
  scanf("%d%d", &rx, &ry);
  do {
    nv = 0;
    tx = 0;
    ty = 0;
    if (x > 0 && y > 0)
      tx = -2 * x;
    else if (y > 0)
      ty = 2 * x;
    else if (x > 0)
      ty = 2 * x - 1;
    else
      tx = -2 * x + 1;
    if (tx + ty < 0) nv = 1;
    if (nv) {
      while (tx++ && (x != rx || y != ry)) x--;
      while (ty++ && (x != rx || y != ry)) y--;
    } else {
      while (tx-- && (x != rx || y != ry)) x++;
      while (ty-- && (x != rx || y != ry)) y++;
    }
    cnt++;
  } while (x != rx || y != ry);
  printf("%d", cnt - 1);
  return 0;
}
