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