import scala.io.{StdIn => in}

object Main extends App {
  val menu = Iterator.continually(in.readInt)
    .take(5).toArray.sortBy(i => if((i % 10) == 0) 0 else 10 - (i%10))
  
  val ans = menu.take(4).map(i => (i + 9) / 10 * 10).sum + menu.last
  println(ans)
}