a=(1..5).map{gets.to_i}.sort{|s,t|s%10<=>t%10}
l=0
a.each_with_index{|e,i|
    if e%10 != 0
        l = i
        break
    end
}
for i in 0..4
    if a[i]%10 != 0 && i != l
        a[i] = (a[i]/10+1)*10
    end
end
p a.inject(:+)