#include <bits/stdc++.h>
using namespace std;
string mirror = "AHIMOTUVWXY";
string letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
  long long n, m, i, j, k, x, y, z, t;
  cin >> x >> y;
  if ((x == 0 || x == 1) && y == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (x == 1 && y == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (x > 0) {
    if (y > -(x - 1) && y <= x) y = 0;
  } else {
    if (y >= x && y < -x) y = 0;
  }
  if (y > 0) {
    if (x >= -y && x < y) x = 0;
  } else {
    if (x > y && x <= abs(y) + 1) x = 0;
  }
  if (x == 0) {
    long long ans = max(0LL, abs(y) - 1) * 4;
    if (y > 0)
      ans += 2;
    else
      ans += 4;
    cout << ans << endl;
    return 0;
  }
  if (y == 0) {
    long long ans = max(0LL, abs(x) - 1) * 4;
    if (x < 0)
      ans += 3;
    else
      ans++;
    cout << ans << endl;
    return 0;
  }
}
