parseInt(x) = parse(Int, x)
min1=9
minsoe=0
array=[0 for i in 1:5]
for i in 1:5
    array[i]=parseInt(readline())
    if (array[i]%10)<min1%10
        min1=array[i]
        minsoe=i
    end
end
time=0
for i in 1:5
   if i != minsoe
        time+=div(array[i]+9,10)*10
    end
end
time+=array[minsoe]
println(time)
