a=Array.new(5,0)
5.times do |i|
    a[i]=gets.to_i
end

ans=1000
[*0..4].permutation.to_a.each do |perm|
    sum=0
    4.times do |i|
        sum+=(a[perm[i]]+9)/10*10
    end
    ans=[ans,sum+a[perm[4]]].min
end
puts ans
