a,b = gets.split.map(&:to_i)
x = y = 0
for i in 1..45
    break if a < (1<<i)
    if (a[i] == 1 && a%2 == 0)
        x ^= (1<<i)
    end
end
for i in 1..45
    break if b < (1<<i)
    if (b[i] == 1 && b%2 == 0)
        y ^= (1<<i)
    end
end
x += 1 if a%4 == 1 || a%4 == 2
y += 1 if b%4 == 1 || b%4 == 2
ans = x^y^a
puts ans