var array: [Int] = []

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

array.sortInPlace { (lhs, rhs) in
  let a = 10 - lhs % 10
  let b = 10 - rhs % 10
  return a < b
}

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 += array[4]

print(sum)
