X,Y=map(int,input().split()) print(list(set([i*4+X%4 for i in range(3)])-set([X,Y]))[0])