function Picker(input) {
  var lines = input.split('\n');
  var fields = lines.reduce(function(all, line) { return all.concat(line.split(' ')); }, []);
  var p = 0;

  return {
    int: function() {
      return parseInt(fields[p++], 10);
    },
    float: function() {
      return parseFloat(fields[p++]);
    },
    str: function() {
      return fields[p++];
    }
  };
}

function Main(input) {
  var pick = Picker(input);
  var list = [pick.int(), pick.int(), pick.int(), pick.int(), pick.int()];
  var mod = list.map(function(e) { return (e % 10 ? e % 10 : 10) - 10; });
  var minMod = mod.sort(function(a, b){ return a - b; })[0];
  var up = list.map(function(e) { return e % 10 ? (e - e % 10) + 10 : e; });

  console.log(up.reduce(function(p, c) { return p + c; }) + minMod);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));