// Arup Guha
// 10/12/2013
// Solution to UCF JV Practice Problem G: Point on Spiral

import java.util.*;

public class g {

	final public static int OFFSET = 100;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int x = stdin.nextInt();
		int y = stdin.nextInt();

		// Store whole grid here.
		int[][] ans = new int[2*OFFSET+1][2*OFFSET+1];
		int curX = 0, curY = 0, dx, dy, curAns = 0;

		// curStep is how many steps in the current direction.
		for (int curStep = 1; curStep<=2*OFFSET; curStep++) {

			// Here is how we calculate dx, given curStep.
			dx = 2*(curStep%2)-1;

			// Fill in our grid.
			for (int i=0; i<curStep; i++) {
				curX += dx;
				ans[curX+OFFSET][curY+OFFSET] = curAns;
			}

			// We turned, so add 1.
			curAns++;

			// Now we will only change in the y direction.
			dy= 2*(curStep%2)-1;

			// Same process.
			for (int i=0; i<curStep; i++) {
				curY += dy;
				ans[curX+OFFSET][curY+OFFSET] = curAns;
			}
			curAns++;
		}

		// Fill in last row.
		for (int i=-99; i<=100; i++)
			ans[i+OFFSET][0] = curAns;

		// Here is our answer.
		System.out.println(ans[x+OFFSET][y+OFFSET]);
	}
}