a = gets.chomp.split(" ").map(&:to_i) a.delete_at(a.index(a.min)) a.delete_at(a.index(a.max)) printf("%.2f\n",a.inject(:+).to_f/a.size)