function Main(input) {
  var args = input.split("\n").filter(f => !!f);
  var times = args.map(t => parseInt(t));
  var timeMods = times.map(t => (t - 1) % 10);
  var timeSep = times.map(t => Math.ceil(t / 10) * 10);
  var min = null;
  var minDef;
  var sum = 0;
  for (var i = 0; i < timeMods.length; i ++) {
    if (min === null || timeMods[i] < min) {
      min = timeMods[i];
      minDef = times[i] - timeSep[i];
    }
    sum += timeSep[i];
  }
  console.log((sum + minDef));

}


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