#include <bits/stdc++.h>
using namespace std;
int ans[500][500];
int main() {
  int n, m, now, i, j, t, x, y;
  scanf("%d%d", &n, &m);
  ans[200][200] = 0;
  x = 0;
  y = 0;
  now = 0;
  t = 1;
  while (1) {
    for (i = 1; i <= t; i++) ans[x + i + 200][y + 200] = now;
    now++;
    for (i = 1; i <= t; i++) ans[x + t + 200][y + i + 200] = now;
    now++;
    for (i = 1; i <= t + 1; i++) ans[x + t - i + 200][y + t + 200] = now;
    now++;
    for (i = 1; i <= t + 1; i++) ans[x - 1 + 200][y + t - i + 200] = now;
    now++;
    x = x - 1;
    y = y - 1;
    t += 2;
    if (x < -100) break;
  }
  printf("%d\n", ans[n + 200][m + 200]);
  return 0;
}
