object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N = 5
  var a = new Array[Int](N)
  for (i <- 0 until N) {
    a(i) = sc.nextInt
  }
  val s = a.map(x => (x + 9) / 10 * 10).sum
  val loss_max = a.map(x => (s - x) % 10).max
  val result = s - loss_max
  println(result)
}