#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int x, y;
  cin >> x >> y;
  if (x == 0 && y == 0 || x == 1 && y == 0)
    cout << 0;
  else {
    long long int maxm = max(abs(x), abs(y));
    long long int turns = 3 + (maxm - 1) * 4;
    if (x > 0 && y < 0 && x - abs(y) == 1)
      cout << turns - 3;
    else if (x == -maxm && y >= -maxm && y < maxm)
      cout << turns;
    else if (y == maxm && x >= -maxm && x < maxm)
      cout << turns - 1;
    else if (x == maxm && y <= maxm && y > -(maxm - 1))
      cout << turns - 2;
    else
      cout << turns + 1;
  }
  return 0;
}
