program main
implicit none
integer :: a( 5 ), t( 5 ), m, i, j

do i = 1, 5
read(*,*) a(i)
if( mod(a(i), 10 ) == 0 ) then
   t( i ) = a( i )
else
   t( i ) = (a( i ) /10+1 )* 10
end if
end do
m = 644
do i = 1, 5
if( sum( t ) - t(i) + a(i) < m ) then
   m = sum( t ) -t(i) + a(i)
end if
end do
write(*,'(i0)') m




end program main
