program main
  implicit none
  
  integer :: a(5), b(5),i,j,n= 5,t,s
  do i = 1, 5
    read(*,*)a(i)
    b(i) = mod(a(i),10)
    if (b(i) == 0) then
      b(i) == 10
    end if
  end do
  
    do i=1,N-1
     do j=i+1,N
        if(b(i) .gt. b(j))then
           t=b(i)
           b(i)=b(j)
           b(j)=t
           t=a(i)
           a(i)=a(j)
           a(j)=t
        end if
     end do
  end do
  
  s = a(1)
  do i = 2, 5
    if b(i) == 10 then
      s = s + a(i)
    else
      s = s + a(i) + (10 - b(i))
    end if
  end do
  
  write(*,*)s
end program main