program bbb
implicit none

integer :: i, m, res
integer, dimension(5) :: meal, one
integer, dimension(1) :: mloc
read*, meal

res=0

do i=1,5
one(i)=meal(i)-(meal(i)/10)*10
if(one(i)==0) one(i)=10
end do

m=minval(one)
mloc=minloc(one)

do i=1, 5
 if(one(i)==10) then
 res=res+meal(i)
 else
 res=res+(meal(i)/10)*10+10
 end if
end do

res=res-10+one(mloc(1))

write(*,'(i0)') res

end program