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