#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, ans;
  while (scanf("%d%d", &x, &y) != EOF) {
    int v = max(abs(x), abs(y));
    if (x >= 0 && y >= 0) {
      if (x == 1 && y == 0) {
        ans = 0;
        printf("%d\n", max(ans, 0));
        continue;
      }
      if (x >= y)
        ans = 4 * v - 3;
      else
        ans = 4 * v - 2;
    } else if (x < 0 && y >= 0) {
      if (abs(y) >= abs(x))
        ans = 4 * v - 2;
      else
        ans = 4 * v - 1;
    } else if (x <= 0 && y < 0) {
      if (abs(x) >= abs(y))
        ans = 4 * v - 1;
      else
        ans = 4 * v;
    } else {
      if (abs(x) > abs(y) + 1)
        ans = 4 * (abs(x) - 1) + 1;
      else
        ans = 4 * abs(y);
    }
    printf("%d\n", max(ans, 0));
  }
  return 0;
}
