#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, ans;
  while (~scanf("%d%d", &x, &y)) {
    ans = -1;
    int f = 1, cnt = 1, ff = 0;
    int s = 0, t = 0;
    while (1) {
      ff++;
      ans++;
      if (f == 1) {
        s = s + cnt;
        f = 2;
        int fff = 0;
        if (t == y) {
          for (int i = 0; i <= cnt; i++) {
            if (s - i == x) {
              fff = 1;
              break;
            }
          }
          if (fff == 1) break;
        }
      } else if (f == 2) {
        t = t + cnt;
        f = 3;
        int fff = 0;
        if (s == x) {
          for (int i = 0; i <= cnt; i++) {
            if (t - i == y) {
              fff = 1;
              break;
            }
          }
          if (fff == 1) break;
        }
      } else if (f == 3) {
        s = s - cnt;
        f = 4;
        int fff = 0;
        if (t == y) {
          for (int i = 0; i <= cnt; i++) {
            if (s + i == x) {
              fff = 1;
              break;
            }
          }
          if (fff == 1) break;
        }
      } else if (f == 4) {
        t -= cnt;
        f = 1;
        int fff = 0;
        if (s == x) {
          for (int i = 0; i <= cnt; i++) {
            if (t + i == y) {
              fff = 1;
              break;
            }
          }
          if (fff == 1) break;
        }
      }
      if (ff % 2 == 0) cnt++;
    }
    printf("%d\n", ans);
  }
  return 0;
}
