program main
  implicit none

1 format(i0)
  
  integer dish(1:5),tmp1,tmp2, i, k
  
  read(*,*) dish(1)
  read(*,*) dish(2)
  read(*,*) dish(3)
  read(*,*) dish(4)
  read(*,*) dish(5)
  
  tmp1 = 10
  k = 0
  do i=1,5
     tmp2 = mod(dish(i),10)
     if (tmp2 /= 0 .and. tmp2 < tmp1) then
        tmp1 = tmp2
        k = i
     end if
  end do
  
  tmp2 = 0
  if (tmp1 == 10) then
     do i=1,5
        tmp2 = tmp2 + dish(i)        
     end do
  else
     do i=1,5
        if (i==k) cycle
        if (mod(dish(i),10) == 0) then
           tmp2 = tmp2 + dish(i)
        else
           tmp2 = tmp2 + (dish(i) / 10 + 1) * 10 
        end if
     end do
     tmp2 = tmp2 + dish(k)
  end if
  
  write(*,1) tmp2
  
end program main
  
  