x,y=map(int,input().split()) c=abs(x-y) minx=min(x,y) maxx=max(x,y) if c==4: if minx>=4: print(minx-4) else: print(maxx+4) else: print(minx+4)