x, y = map(int, input().split()) print((((x >> 2) ^ (y >> 2) ^ 3) << 2) | (x & 3))