implicit none
integer,dimension(5)::a
integer i
integer:: min1=10
integer:: sum=0

do i=1,5
read(5,*) a(i)

if(mod(a(i),10).eq.0) then
sum=sum+a(i)
else
sum=sum+(a(i)/10+1)*10
if(mod(a(i),10).lt.min1) then
min1=mod(a(i),10)
endif
endif

enddo

if(min1.eq.10) then
write(6,*)sum
else
write(6,*)sum-10+min1
endif

end