#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  while (scanf("%d %d", &x, &y) == 2) {
    if ((x == 0 && y == 0) || (x == 1 && y == 0)) {
      printf("0\n");
      continue;
    }
    int m = ((abs(x)) > (abs(y)) ? (abs(x)) : (abs(y)));
    int ans = (m - 1) * 4;
    if ((x == m) && (x + y > 1))
      ans += 1;
    else if ((y == m) && (x != y))
      ans += 2;
    else if ((x == -m) && (y != m))
      ans += 3;
    else if ((y == -m) && (x != -m))
      ans += 4;
    printf("%d\n", ans);
  }
  return 0;
}
