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 (a,b) = ts.partition(_ % 10 == 0)

    val res = if (b.isEmpty) a.sum
    else {
      val bb = b.map( _ % 10)
      val bMin = bb.min
      val bbb = b.map(t => (t + 9)/10 * 10).sum - ((bMin + 9)/10 * 10) + bMin
      a.sum + bbb
    }

    println(res)
  }
}