해설 값을 받은뒤 계산하여 출력하면됩니다.
nums = gets.chomp.split(" ") total = nums.pop.to_i**2 nums.each { |n| total += n.to_i**2 } puts total%10