#include <bits/stdc++.h>
int find(int x) {
  if (x > 0)
    return x;
  else
    return -x;
}
int main() {
  int x, y;
  while (scanf("%d%d", &x, &y) != EOF) {
    if (x == 0 && y == 0) {
      printf("%d\n", 0);
      continue;
    }
    if (x > 0 && y <= 0 && x == find(y) + 1)
      printf("%d\n", (x - 1) * 4);
    else if (find(x) >= find(y) && x > 0 && x != -y)
      printf("%d\n", (x - 1) * 4 + 1);
    else if (find(y) >= find(x) && y > 0)
      printf("%d\n", (y - 1) * 4 + 2);
    else if (find(x) >= find(y) && x < 0)
      printf("%d\n", (-x - 1) * 4 + 3);
    else
      printf("%d\n", -y * 4);
  }
  return 0;
}
