#include <bits/stdc++.h>
template <class T>
using matrix_t = std::vector<std::vector<T>>;
int main() {
  int x, y;
  std::cin >> x >> y;
  if (x == 0 && y == 0) {
    std::cout << 0 << std::endl;
    return 0;
  }
  if (x == 1 && y == 0) {
    std::cout << 0 << std::endl;
    return 0;
  }
  auto res = (std::max(std::abs(x), std::abs(y)) - 1) * 4;
  if (x <= y) {
    if (x >= -y)
      res += 2;
    else
      res += 3;
  } else {
    if (x > -y + 1)
      res += 1;
    else
      res += 4;
  }
  if (x - 1 == -y && x > 0) res -= 4;
  if (x > 0 && x == y) res -= 1;
  std::cout << res << std::endl;
  return 0;
}
