program main
  implicit none
  integer :: a(5), i, res
  res = 0
  do i = 1, 5
    read (*, *) a(i)
    res = res + roundup(a(i))
  end do

  print "(i0)", res - (10 - minlast(a))

  contains

  pure function minlast(a)
    integer, intent(in) :: a(5)
    integer :: minlast
    minlast = minval(mod(a - 1, 10) + 1)
  end function minlast

  pure function roundup(x)
    integer, intent(in) :: x
    integer :: roundup
    roundup = int(ceiling(x * 0.1)) * 10
  end function roundup
end program main
