import scala.math.ceil

object Main extends App {

  val sc = new java.util.Scanner(System.in) 
  val t = Array.fill(5)(sc.nextInt())
  val last = t.map(x => x % 10).filter(x => x != 0).min
  val up = t.map(x => (ceil(x.toDouble / 10) * 10).toInt).sum
  println(up - (10 - last))
}