menu=[]
5.times{
    menu << gets.to_i
}

time=0

menu.map{|i| i%10}.sort.each{|a|
    if a.nonzero?
        time=a-10
        break
    end
}

time+=menu.map{|i| (i.to_f/10).ceil*10}.inject(:+)

puts time