#include <bits/stdc++.h>
using namespace std;
int x, y;
const int cx[] = {1, 0, -1, 0};
const int cy[] = {0, 1, 0, -1};
int main() {
  cin >> x >> y;
  int x0 = 0, y0 = 0;
  int d = 0, l = 0, turn = 0;
  while (1) {
    l++;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < l; j++) {
        if (make_pair(x0, y0) == make_pair(x, y)) {
          cout << turn;
          return 0;
        }
        x0 += cx[d];
        y0 += cy[d];
      }
      if (make_pair(x0, y0) == make_pair(x, y)) {
        cout << turn;
        return 0;
      }
      d = (d + 1) % 4;
      turn++;
    }
  }
  return 0;
}
