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