import java.util.Scanner


object MainB {

  // 切り上げる
  def roundUp10(x:Int): Int ={
    if(x % 10 == 0) x
    else (x/10 + 1)*10
  }
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val minList = for (_ <- 0 until 5) yield sc.nextInt
    val sortedMinList = minList.sortBy(n => if(n%10==0) 10 else n%10)
    println(sortedMinList.tail.map(roundUp10).sum + sortedMinList(0))
  }
}