#include <bits/stdc++.h>
using namespace std;
int maps[110][110];
int main() {
  int a, b;
  while (cin >> a >> b) {
    if (a == b && a == 0) {
      cout << 0 << endl;
      continue;
    }
    if (b > 0 && ((a >= 0 && a < b) || (a < 0 && -a <= b))) {
      cout << (b - 1) * 4 + 2 << endl;
    } else if (a < 0 && ((b <= 0 && b >= a) || (b > 0 && b < -a))) {
      cout << (-a - 1) * 4 + 3 << endl;
    } else if (b <= 0 && ((a <= 0 && a >= b) || (a > 0 && a <= -b + 1))) {
      cout << -b * 4 << endl;
    } else {
      cout << (a - 1) * 4 + 1 << endl;
    }
  }
  return 0;
}
