program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n,ans
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
    ans=0
    c=10

    do i=1,5
    read(*,*) a
    ans=ans+(a-1)/10+1
    b=mod(a,10)
    if(b<c .and. b/=0)then
        c=b
    end if
    end do
    
    write(*,*)ans*10-10+c
   
    stop
end program sample
  

