import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val inputs = Vector.fill(5)(sc.nextInt)

    val answer = (inputs.map(_ / 10 + 1).sum - inputs.count(_ % 10 == 0)) * 10 - inputs.filter(_ % 10 != 0).map(10 - _ % 10).max
    println(answer)
  }
}
