x, y = map(int,input().split()) for i in range(12): if i == x or i == y: continue if abs(i-x)%4 == abs(y-i)%4 == 0: print(i)