#include <bits/stdc++.h>
using namespace std;
int cadran(int x, int y) {
  if (x >= 0 && y >= 0)
    return 1;
  else if (x <= 0 && y >= 0)
    return 2;
  else if (x <= 0 && y <= 0)
    return 3;
  else if (x >= 0 && y <= 0)
    return 4;
}
int a[202][202];
int main() {
  int x, y, m, s = 0;
  cin >> x >> y;
  if ((x == 1 && y == 0) || (x == 0 && y == 0))
    cout << "0";
  else {
    m = ((abs(x) > abs(y)) ? abs(x) : abs(y));
    s += (m - 1) * 4;
    if (cadran(x, y) == 1) {
      if (abs(y) > abs(x)) s += 1;
      s += 1;
    } else if (cadran(x, y) == 2) {
      if (abs(x) > abs(y)) s += 1;
      s += 2;
    } else if (cadran(x, y) == 3) {
      if (abs(x) < abs(y)) s += 1;
      s += 3;
    } else if (cadran(x, y) == 4) {
      if (abs(x) > abs(y) + 1)
        s += 1;
      else if (abs(y) >= abs(x))
        s += 4;
    }
    cout << s;
  }
  cin.get();
  cin.get();
}
