#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int ans;
  if ((x == 0 and y == 0) or (x == 1 and y == 0)) {
    ans = 0;
  } else if ((x > abs(y) and x + y != 1 and x > 0) or (x == y and y > 0)) {
    ans = 1 + 4 * (x - 1);
  } else if ((abs(x) < y or (-1 * x == y)) and y > 0) {
    ans = 2 + 4 * (y - 1);
  } else if (abs(x) >= abs(y) and x < 0) {
    ans = 3 + 4 * (abs(x) - 1);
  } else if ((abs(x) < abs(y) or x + y == 1 or x == -1 * y) and y < 0) {
    ans = 4 + 4 * (abs(y) - 1);
  }
  cout << ans;
  return 0;
}
