x,y = map(int,input().split()) corner = [(x+4)%12,(x+8)%12] corner.remove(y) print(corner[0])