var array: [Int] = []
var sum = 0

for _ in 0..<5 {
  let item = Int(readLine()!)!
  let a = item % 10
  sum += (item - a)
  if a != 0 {
    array.append(a)
  }
}

if array.count == 0 {
  print(sum)
} else {
  array.sortInPlace { (lhs, rhs) in
    return lhs > rhs
  }
  for i in 0..<array.count-1 {
    let item = array[i]
    let amari = item % 10
    let add = item + 10 - amari
    sum += add
  }
  sum += array[array.count-1]
  print(sum)
}
