object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val values = Array.fill(5)(sc.nextInt())
    val (justs, notJusts) = values.partition(_ % 10 == 0)
    val sorted = notJusts.sortBy(_ % 10)
    val head = sorted.head
    val tail = sorted.tail.map(_ / 10 * 10 + 10).sum
    println(justs.sum + head + tail)
  }

}
