'use strict'

const main = (input) => {
    input = input.split('\n').slice(0, 5)
    let tmpIndex = 0;
    let tmp = 9;
    input.forEach((item, index) => {
      const num = Number(item.slice(-1))
      if (num < tmp && num !== 0) {
        tmp = num
        tmpIndex = index
      }
    })

    // console.log(tmpIndex)
    // console.log(tmp)

    let sum = 0
    input.forEach((item, index) => {
      if (tmpIndex === index) {
        sum += Number(item)
      } else { 
        sum += Math.ceil(Number(item) / 10) * 10
      }
    })
    console.log(sum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))