x, y = map(int,input().split()) print((y ^ (x + 4) ^ (x - 4)) % 12)