import java.util.Scanner
object Main extends App {
  val sc = new Scanner(System.in)
  val ds = Array.fill(5)(sc.nextInt)
  val sum = ds.map(d => (d + 9) / 10 * 10).sum
  val correct = ds.map(_ % 10).filter(_ != 0) match {
    case Array() => 0
    case l => 10 - l.min
  }
  println(sum - correct)
}