program main
  implicit none
  integer a, b, c, d, e, min10, min10i
  read(*, *) a
  read(*, *) b
  read(*, *) c
  read(*, *) d
  read(*, *) e
  if (mod(a,10) == 0) then
    a = a-10
  end if
  if (mod(b,10) == 0) then
    b = b-10
  end if
  if (mod(c,10) == 0) then
    c = c-10
  end if
  if (mod(d,10) == 0) then
    d = d-10
  end if
  if (mod(e,10) == 0) then
    e = e-10
  end if
!    min10 = 9

    min10 = mod(a,10)

  if (min10 > mod(b,10).and. mod(b,10)>0) then
    min10 = mod(b,10)
  end if
  if (min10 > mod(c,10).and. mod(c,10)>0) then
    min10 = mod(c,10)
  end if
  if (min10 > mod(d,10).and. mod(d,10)>0) then
    min10 = mod(d,10)
  end if
  if (min10 > mod(e,10).and. mod(e,10)>0) then
    min10 = mod(e,10)
  end if

  a = a/10
  

  a = 10*(a + 1)
  !min10 = mod(a,10)
  !min10i = a
  b = b/10


    b = 10*(b + 1)
  c = c/10


    c = 10*(c + 1)
  d = d/10

    d = 10*(d + 1)
  e = e/10


    e = 10*(e + 1)
  
  write(*, '(i0)') a+b+c+d+e + (min10 - 10)

end program main