#include <bits/stdc++.h>
using namespace std;
bool isSubSequence(string str1, string str2, int m, int n) {
  int j = 0;
  for (int i = 0; i < n && j < m; i++) {
    if (str1[j] == str2[i]) j++;
  }
  return (j == m);
}
int isPrime(long long n) {
  for (int i = 2; i < sqrt(n); i++)
    if (n % i == 0) return 0;
  return 1;
}
int isSquare(long long n) { return (long long)sqrt(n) * (sqrt(n)) == n; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int i, j = 0, n, m, k = 0;
  int x, y;
  cin >> x >> y;
  if (x == 0 && y == 0 || x == 1 && y == 0)
    cout << 0;
  else if (y < 0 && x - y > 0 && x + y - 1 <= 0)
    cout << 4 * abs(y);
  else if (x > 0 && x + y - 1 > 0 && x - y >= 0)
    cout << 4 * (x - 1) + 1;
  else if (y > 0 && x - y < 0 && x + y >= 0)
    cout << 4 * (y - 1) + 2;
  else if (x < 0 && x + y < 0 && x - y <= 0)
    cout << 4 * (abs(x) - 1) + 3;
  return 0;
}
