<?php
$min = 0;

for ($i = 0; $i < 5; $i++) {
  $times[] = nextInt();
}
$a = array_map(function ($time) {
  return ceil($time / 10) * 10;
}, $times);
$b = array_sum($a);

$c = array_map(function ($time) {
  return $time % 10;
}, $times);
$minOnesPlace = min(array_filter($c, function ($i) {
  return $i != 0;
}));
echo $b - (10 - $minOnesPlace), PHP_EOL;

function nextInt()
{
  return (int) trim(fgets(STDIN));
}
