#include <bits/stdc++.h>
using namespace std;
const unsigned int MODULO = 1000000007;
const int INF = 100000000;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int main() {
  int n, m;
  cin >> n >> m;
  int cnt = 0;
  int x = 0, y = 0;
  while (x != n || y != m) {
    cnt++;
    if (cnt % 4 == 1) {
      if (y == m && x <= n && n <= -x + 1) break;
      x = -x + 1;
    } else if (cnt % 4 == 2) {
      if (x == n && y <= m && m <= x) break;
      y = x;
    } else if (cnt % 4 == 3) {
      if (y == m && -x <= n && n <= x) break;
      x = -x;
    } else {
      if (x == n && -y <= m && m <= y) break;
      y = -y;
    }
  }
  cout << max(cnt - 1, 0) << endl;
  return 0;
}
