//https://atcoder.jp/contests/abc123/tasks/abc123_b
function setUp(input) {
  input = input.split("\n");
  a = Number(input[0]);
  b = Number(input[1]);
  c = Number(input[2]);
  d = Number(input[3]);
  e = Number(input[4]);
  main();
}
function main() {
  var total = ceil(a) + ceil(b) + ceil(c) + ceil(d) + ceil(e);
  var firstArray = [first(a), first(b), first(c), first(d), first(e)];
  var minFirst;
  debugger;
  firstArray.forEach(function (d, i) {
    if (d !== 0 && (!minFirst || minFirst > d)) {
      minFirst = d;
    }
  });
  if (minFirst) {
    total -= (10 - minFirst);
  }
  console.log(total);
}
function ceil(num) {
  return Math.ceil(num / 10) * 10;
}
function first(num) {
  var str = num.toString();
  return Number(str.substring(str.length - 1));
}
// setUp('10\n10\n10\n10\n10')
setUp(require("fs").readFileSync("/dev/stdin", "utf8"));