#include <bits/stdc++.h>
using namespace std;
int x, y;
int main() {
  cin >> x >> y;
  if ((x == 0) && (y == 0))
    cout << 0 << endl;
  else {
    int t = 1, x1 = 0, y1 = 0, ans = 0;
    bool flag = false;
    while (1) {
      for (int i = 1; i <= t; i++) {
        x1++;
        if ((x == x1) && (y == y1)) {
          flag = true;
          break;
        }
      }
      if (flag) break;
      ans++;
      for (int i = 1; i <= t; i++) {
        y1++;
        if ((x == x1) && (y == y1)) {
          flag = true;
          break;
        }
      }
      if (flag) break;
      ans++;
      for (int i = 1; i <= t + 1; i++) {
        x1--;
        if ((x == x1) && (y == y1)) {
          flag = true;
          break;
        }
      }
      if (flag) break;
      ans++;
      for (int i = 1; i <= t + 1; i++) {
        y1--;
        if ((x == x1) && (y == y1)) {
          flag = true;
          break;
        }
      }
      if (flag) break;
      ans++;
      t += 2;
    }
    cout << ans << endl;
  }
  return 0;
}
