#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int x, y;
  cin >> x >> y;
  int u = 0, v = 0, turns = 0, flag = 1, c = 1;
  while (1) {
    if (u == x and v == y) break;
    if (flag == 1) {
      int d = 0;
      while (d != c) {
        u++;
        if (u == x and v == y) break;
        d++;
      }
      flag = 2;
      if (u != x or v != y) turns++;
    } else if (flag == 2) {
      int d = 0;
      while (d != c) {
        v++;
        if (u == x and v == y) break;
        d++;
      }
      if (u != x or v != y) turns++;
      flag = 3;
      c++;
    } else if (flag == 3) {
      int d = 0;
      while (d != c) {
        u--;
        if (u == x and v == y) break;
        d++;
      }
      flag = 4;
      if (u != x or v != y) turns++;
    } else if (flag == 4) {
      int d = 0;
      while (d != c) {
        v--;
        if (u == x and v == y) break;
        d++;
      }
      c++;
      flag = 1;
      if (u != x or v != y) turns++;
    }
  }
  cout << turns;
  return 0;
}
