PROGRAM ATCODER

implicit none
integer :: a(5),i,dp=10,index=6,ans=0

do i = 1, 5
  read*, a(i)
  call chmin(dp,mod(a(i),10),index,i)
end do

do i = 1, 5
  if ( i == index .or. mod(a(i),10) == 0 ) cycle
  if ( a(i) < 10 ) then
    a(i) = 10
    cycle
  end if
  a(i) = (a(i)/10)*10 + 10
end do

do i = 1, 5, 1
  ans = ans + a(i)
end do

print'(i0)', ans 

contains
  subroutine chmin(dp,x,index,i)
  implicit none
  integer :: dp,x,index,i

  if (dp > x .and. x /= 0) then
  	dp = x
    index = i
  	return
  end if
  
  end subroutine

END PROGRAM ATCODER