#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int dx[] = {1, 0, -1, 0};
  int dy[] = {0, 1, 0, -1};
  if (x == 0 && y == 0) {
    cout << "0";
    return 0;
  }
  int d = 0;
  int cx = 0;
  int cy = 0;
  int result = 0;
  int step = 1;
  while (1) {
    for (int i = 0; i < step; ++i) {
      cx += dx[d];
      cy += dy[d];
      if (x == cx && y == cy) {
        cout << result;
        return 0;
      }
    }
    d = (d + 1) % 4;
    if (result % 2 == 1) step++;
    result++;
  }
  return 0;
}
