object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.toInt)
  val sl = ls.sortBy(e => (e + 9) % 10)
  val dl = sl.tail.map(e=> (e + 9) / 10 * 10)
  val ret = dl.sum + sl.head  
  println(ret)
}
