#include<bits/stdc++.h>
#define int long long
using namespace std;
int input() {
	int r;
	scanf("%lld", &r);
	return r;
}
signed main() {
	int x = input(), y = input();
	if      (       0 <= x && x <=       0 &&        0 <= y && y <=       0)printf("1\n");//1
	else if (       1 <= x && x <=       1 &&        0 <= y && y <=       0)printf("2\n");//1
	else if (       0 <= x && x <=       1 &&        1 <= y && y <=       2)printf("3\n");//2
	else if (      -3 <= x && x <=      -1 &&        0 <= y && y <=       2)printf("1\n");//3
	else if (      -3 <= x && x <=       1 &&       -5 <= y && y <=      -1)printf("2\n");//5
	else if (       2 <= x && x <=       9 &&       -5 <= y && y <=       2)printf("3\n");//8
	else if (      -3 <= x && x <=       9 &&        3 <= y && y <=      15)printf("1\n");//13
	else if (     -24 <= x && x <=      -4 &&       -5 <= y && y <=      15)printf("2\n");//21
	else if (     -24 <= x && x <=       9 &&      -39 <= y && y <=      -6)printf("3\n");//34
	else if (      10 <= x && x <=      64 &&      -39 <= y && y <=      15)printf("1\n");//55
	else if (     -24 <= x && x <=      64 &&       16 <= y && y <=     104)printf("2\n");//89
	else if (    -168 <= x && x <=     -25 &&      -39 <= y && y <=     104)printf("3\n");//144
	else if (    -168 <= x && x <=      64 &&     -272 <= y && y <=     -40)printf("1\n");//233
	else if (      65 <= x && x <=     441 &&     -272 <= y && y <=     104)printf("2\n");//377
	else if (    -168 <= x && x <=     441 &&      105 <= y && y <=     714)printf("3\n");//610
	else if (   -1155 <= x && x <=    -169 &&     -272 <= y && y <=     714)printf("1\n");//987
	else if (   -1155 <= x && x <=     441 &&    -1869 <= y && y <=    -273)printf("2\n");//1597
	else if (     442 <= x && x <=    3025 &&    -1869 <= y && y <=     714)printf("3\n");//2584
	else if (   -1155 <= x && x <=    3025 &&      715 <= y && y <=    4895)printf("1\n");//4181
	else if (   -7920 <= x && x <=   -1156 &&    -1869 <= y && y <=    4895)printf("2\n");//6765
	else if (   -7920 <= x && x <=    3025 &&   -12815 <= y && y <=   -1870)printf("3\n");//10946
	else if (    3026 <= x && x <=   20736 &&   -12815 <= y && y <=    4895)printf("1\n");//17711
	else if (   -7920 <= x && x <=   20736 &&     4896 <= y && y <=   33552)printf("2\n");//28657
	else if (  -54288 <= x && x <=   -7921 &&   -12815 <= y && y <=   33552)printf("3\n");//46368
	else if (  -54288 <= x && x <=   20736 &&   -87840 <= y && y <=  -12816)printf("1\n");//75025
	else if (   20737 <= x && x <=  142129 &&   -87840 <= y && y <=   33552)printf("2\n");//121393
	else if (  -54288 <= x && x <=  142129 &&    33553 <= y && y <=  229970)printf("3\n");//196418
	else if ( -372099 <= x && x <=  -54289 &&   -87840 <= y && y <=  229970)printf("1\n");//317811
	else if ( -372099 <= x && x <=  142129 &&  -602069 <= y && y <=  -87841)printf("2\n");//514229
	else if (  142130 <= x && x <=  974169 &&  -602069 <= y && y <=  229970)printf("3\n");//832040
	else if ( -372099 <= x && x <=  974169 &&   229971 <= y && y <= 1576239)printf("1\n");//1346269
	else if (-2550408 <= x && x <= -372100 &&  -602069 <= y && y <= 1576239)printf("2\n");//2178309
	else if (-2550408 <= x && x <=  974169 && -4126646 <= y && y <= -602069)printf("3\n");//3524578
	else if (  974169 <= x && x <= 4498746 && -4126646 <= y && y <= 1576239)printf("1\n");//3524578
}


Measured memory_bytes: 3152