#include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e6 + 1;
const long long MNN = 5e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double EPS = 1e-9;
long long x, y, x1, road_to_respa_bronze, ans, cur;
void q() {
  if (x1 == x && road_to_respa_bronze == y) {
    printf("%I64d", ans);
    exit(0);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%I64d%I64d", &x, &y);
  for (;;) {
    q();
    cur++;
    for (long long i = 1; i <= cur; i++) {
      x1++;
      q();
    }
    ans++;
    for (long long i = 1; i <= cur; i++) {
      road_to_respa_bronze++;
      q();
    }
    ans++;
    cur++;
    for (long long i = 1; i <= cur; i++) {
      x1--;
      q();
    }
    ans++;
    for (long long i = 1; i <= cur; i++) {
      road_to_respa_bronze--;
      q();
    }
    ans++;
  }
  return 0;
}
