arr = Array.new(3) arr[0], arr[1], n = gets.split.map(&:to_i) arr[2] = arr[0] ^ arr[1] p arr[n % 3]