X,Y = map(int, input().split()) for i in range(12): if X%4==i%4 and X!=i and Y!=i: print(i)