#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, int m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int a, b;
  cin >> a >> b;
  int tr = 0;
  int nx, ny;
  int x = 0, y = 0;
  for (int j = x; j <= (x + 1); j++) {
    nx = j;
    if (a == nx && b == y) {
      cout << tr;
      return 0;
    }
  }
  x = nx;
  tr++;
  for (int i = y; i <= (y + 1); i++) {
    ny = i;
    if (a == x && b == ny) {
      cout << tr;
      return 0;
    }
  }
  y = ny;
  tr++;
  for (int j = x; j >= (-x); j--) {
    nx = j;
    if (a == nx && b == y) {
      cout << tr;
      return 0;
    }
  }
  x = nx;
  tr++;
  for (int i = y; i >= (-y); i--) {
    ny = i;
    if (a == x && b == ny) {
      cout << tr;
      return 0;
    }
  }
  y = ny;
  tr++;
  while (1) {
    for (int j = x; j <= ((-x) + 1); j++) {
      nx = j;
      if (a == nx && b == y) {
        cout << tr;
        return 0;
      }
    }
    x = nx;
    tr++;
    for (int i = y; i <= ((-y) + 1); i++) {
      ny = i;
      if (a == x && b == ny) {
        cout << tr;
        return 0;
      }
    }
    y = ny;
    tr++;
    for (int j = x; j >= (-x); j--) {
      nx = j;
      if (a == nx && b == y) {
        cout << tr;
        return 0;
      }
    }
    x = nx;
    tr++;
    for (int i = y; i >= (-y); i--) {
      ny = i;
      if (a == x && b == ny) {
        cout << tr;
        return 0;
      }
    }
    y = ny;
    tr++;
  }
}
