input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n').map((x) => x * 1)
min = 10
sum = 0
lines.forEach((x) => {
    a = x % 10
    min = min > a && a > 0 ? a : min
})
lines.forEach((x) => {
    a = x % 10
    if (min == a) {
        sum += x
        min = 10    
    } else {
        sum += ~~((x + 10 - 1) / 10 ) * 10
    }
})
console.log(sum)