import java.util.Scanner

fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  val list = ArrayList<Int>()

  var min = 9
  var sum = 0
  for (i in 0..4) {
    list.add(scanner.nextInt())
    min = if (list[i] % 10 != 0) { if (list[i] % 10 < min) list[i] % 10 else min } else min
    sum = (list[i] / 10) * 10
  }
  scanner.close()
  println(sum - 10 + min)
}