p0=[0,4,8] p1=[1,5,9] p2=[2,6,10] p3=[3,7,11] x,y=map(int,input().split()) if x%4==0: for a in p0: if not a==x or a==y: print(a) elif x%4==1: for a in p1: if not a==x or a==y: print(a) elif x%4==2: for a in p2: if not a==x or a==y: print(a) else: for a in p3: if not a==x or a==y: print(a)