program fivedishes
  implicit none

integer::a(5),i,count=0,m=615

do i=1,5
   read*,a(i)
   if(mod(a(i),10)==0)then
      count=count+a(i)
   else
      count=count+(a(i)/10+1)*10
   end if
end do

do i=1,5
   if(mod(a(i),10)/=0)then
      if(count-(a(i)/10+1)*10+a(i)<m)then
         m=count-(a(i)/10+1)*10+a(i)
      end if
   end if
end do

 print*,m

end program fivedishes