import java.util.Scanner

object Main {
  val sc = new Scanner(System.in)
  def main(args: Array[String]): Unit = {
    val ts = List.fill(5)(sc.nextInt)
    val rm = ts.map(_ % 10).filter(_ != 0)
    val r  = if(rm.nonEmpty) rm.min  else 0

    val res = ts.map(t => (t+ 9)/10 * 10).sum - 10 + r

    println(res)

  }
}