#include <bits/stdc++.h>
using namespace std;
int a[200005];
int mov[][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
int main() {
  int x, y;
  scanf("%d %d", &x, &y);
  int ans = 0;
  int xi = 0, yi = 0;
  for (int k = 1; xi <= 100 || yi <= 100; k++) {
    int d = (k + 1) / 2;
    int xj = xi + d * mov[(k - 1) % 4][0];
    int yj = yi + d * mov[(k - 1) % 4][1];
    if (xi == xj) {
      if (x == xi && min(yi, yj) <= y && y <= max(yi, yj)) {
        ans = k - 1;
        break;
      }
    } else {
      if (y == yi && min(xi, xj) <= x && x <= max(xi, xj)) {
        ans = k - 1;
        break;
      }
    }
    xi = xj;
    yi = yj;
  }
  printf("%d\n", ans);
  return 0;
}
