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