'use strict'
const num = 5
function main(o) {
  o = o.split('\n').map(v => ~~v)
  let foods = o.slice(0, 5)

  let foods1 = []
  let foods2 = []
  for (let i = 0; i < num; i++) {
    if (foods[i] % 10 > 0) {
      foods1.push(foods[i])
    } else {
      foods2.push(foods[i])
    }
  }
  foods1.sort((a, b) => {
    return a % 10 < b % 10
  })

  let time = 0

  for (let i = 0; i < foods1.length - 1; i++) {
    time += foods1[i] + (10 - foods1[i] % 10)
  }

  for (let i = 0; i < foods2.length; i++) {
    time += foods2[i]
  }

  for (let i = foods1.length - 1; i < foods1.length; i++) {
    time += foods1[i]
  }

  console.log(time)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
