var array: [Int] = []
var amari = 10
var index = 0
var num = 0

for _ in 0..<5 {
  let line = readLine()!
  array.append(Int(line)!)
}

for i in 0..<5 {
  let item = array[i]
  let a = 10 - item % 10
  if a <= amari {
    amari = a
    index = i
  }
}

num = array.removeAt(index)

var sum = 0
for i in 0..<4 {
  let item = array[i]
  let amari = item % 10
  if amari == 0 {
    sum += item
  } else {
    sum += item + 10 - amari
  }
}
sum += num

print(sum)
