l = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n').map(n => n | 0)
ans = 9
n = 9
for (j = 0; j < 5; j++) {
  i = l[j] % 10
  if (i != 0 && i < ans) {
    ans = i
    n = j
  }
}
m = l.splice(n, 1)
r = 0
l.map(i => r += (Math.ceil(i / 10) * 10))
console.log(r + m[0])