program five_dishes
  implicit none
  integer :: a(5) = 0, i, m, s
  do i = 1, 5
    read(*,*) a(i)
  end do
  s = sum((a+9)/10*10)
  m = s
  do i = 1, 5
    m = min(m,s-(a(i)+9)/10*10+a(i))
  end do
  write(*,'(i0)') m
end program five_dishes