#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int x, y;
  cin >> x >> y;
  if (x > 0 && y > (-(x - 1)) && y < x)
    y = x;
  else if (y > 0 && x < y && x > (-y))
    x = -y;
  else if (x < 0 && y < (-x) && y > x)
    y = x;
  else if (y < 0 && x > y && x < (1 - y))
    x = -y + 1;
  if (x == 0 && y == 0)
    cout << "0" << endl;
  else if (x == 1 && y == 0)
    cout << "0" << endl;
  else if (x == y && x > 0)
    cout << (1 + 4 * (x - 1));
  else if (x < 0 && y > 0)
    cout << (2 + 4 * (y - 1));
  else if (x < 0 && y < 0)
    cout << (3 + 4 * ((-x) - 1));
  else if (x > 0 && y < 0)
    cout << (4 + 4 * (x - 2));
  return 0;
}
