<?php

$is_honban = 1;

if ($is_honban) {
  //----------------------------------------------------------------------------------
  // Input for honban
  //----------------------------------------------------------------------------------
  $sc = new Scanner();
  $a = array();
  $a[] = $sc->nextInt();
  $a[] = $sc->nextInt();
  $a[] = $sc->nextInt();
  $a[] = $sc->nextInt();
  $a[] = $sc->nextInt();

//  $t = array();
//  $d = array();
//  for ($i = 0; $i < $n; $i++) {
//    $t[] = $sc->next();
//    $d[] = $sc->next();
//  }


} else {
  //----------------------------------------------------------------------------------
  // Input for test
  //----------------------------------------------------------------------------------
  error_reporting(E_ERROR | E_WARNING | E_PARSE);

  $n = 8;
  $q = 3;
  $s = 'AABCBDBA';
  $t = array('A','B','A');
  $d = array('L','R','R');



}
//----------------------------------------------------------------------------------
// Main
//----------------------------------------------------------------------------------

$ans = 0;

$k = min($a[0] % 10, $a[1] % 10, $a[2] % 10, $a[3] % 10, $a[4] % 10);
for ($i = 0; $i < 5; $i++) {
  if ($a[$i] % 10 == $k) { break; }
}
for ($j = 0; $j < 5; $j++) {
  if ($j == $i) {
    $ans += $a[$i];
  } else {
    $ans += ceil($a[$j]/10)*10;
  }
}




//----------------------------------------------------------------------------------
// Output
//----------------------------------------------------------------------------------
out::println($ans);



//----------------------------------------------------------------------------------
// Ref: https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
//----------------------------------------------------------------------------------
class Scanner {
  private $arr = array();
  private $count = 0;
  private $pointer = 0;
  public function next() {
    if($this->pointer >= $this->count) {
      $str = trim(fgets(STDIN));
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    $this->pointer++;
    return $result;
  }
  public function hasNext() {
    return $this->pointer < $this->count;
  }
  public function nextInt() {
    return (int)$this->next();
  }
  public function nextDouble() {
    return (double)$this->next();
  }
}

class out {
  public static function println($str = "") {
    echo $str . PHP_EOL;
  }
}

?>
