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