#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
vector<pair<long long int, pair<long long int, long long int> > > edge;
long long int size[N], parent[N];
const long long int maxn = 1e6 + 2;
long long int res[maxn], total[maxn];
void make_set(long long int node) {
  parent[node] = node;
  size[node] = 0;
}
long long int find_set(long long int node) {
  if (node == parent[node]) return node;
  return parent[node] = find_set(parent[node]);
}
void union_sets(long long int a, long long int b) {
  if (size[a] < size[b]) swap(a, b);
  parent[b] = a;
  if (size[a] == size[b]) size[a]++;
}
int32_t main() {
  long long int x, y;
  cin >> x >> y;
  if (x == 0 && y == 0)
    cout << 0 << endl;
  else {
    long long int c = 0;
    long long int x1 = 1, y1 = 0;
    while (1) {
      if (x == x1 && y == y1) break;
      long long int hx = x1, hy = y1;
      y1 = x1;
      c++;
      if (x == x1 && (y >= min(hy, y1) && y <= max(y1, hy))) break;
      hx = x1, hy = y1;
      x1 = -1 * x1;
      c++;
      if (y == y1 && (x >= min(hx, x1) && x <= max(x1, hx))) break;
      hx = x1, hy = y1;
      y1 = -1 * y1;
      c++;
      if (x == x1 && (y >= min(hy, y1) && y <= max(y1, hy))) break;
      hx = x1, hy = y1;
      x1 = abs(x1) + 1;
      c++;
      if (y == y1 && (x >= min(hx, x1) && x <= max(x1, hx))) break;
    }
    cout << c << endl;
  }
  return 0;
}
