def to_binary(i)
  # 左から下位桁だよ
  bins = []
  while i > 0
    bins.push(i % 2)
    i /= 2
  end
  bins
end
def to_digit(bins)
  result = 0
  bins.reverse.each do |binary|
    result = result * 2 + binary
  end
  result
end
def xor(a, b)
  bins = []
  [a.size, b.size].max.times do |i|
    bins[i] = ((a[i] || 0) + (b[i] || 0)) % 2
  end
  bins
end

a,b = gets.split.map(&:to_i)
xor_list = []

case a%4
when 0 then;;
when 1 then; xor_list.concat([a, a+1, a+2])
when 2 then; xor_list.concat([a, a+1])
when 3 then; xor_list.concat([a])
end

case b%4
when 0 then; xor_list.concat([b])
when 1 then; xor_list.concat([b, b-1])
when 2 then; xor_list.concat([b, b-1, b-2])
when 3 then;;
end

puts to_digit(xor_list.map{|i| to_binary(i) }.inject([]){|a,b| xor(a,b) })
