"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};

function main(input) {
  const o = new I(input);

  var arr = [];
  var mod = 10;
  for (var i = 0; i < 5 ; i++){
    var m = o.a();
    var mm = m % 10;
    if ( mm < mod  && mm > 0) {
      mod = mm;
    }
    arr.push(m);
  }

  if (mod === 10) {
    console.log(arr.reduce((acc, cur) => acc + cur));
  } else {
    var sum = 0;
    for (var i = 0; i < 5 ; i++){
      if (arr[i]%10 === 0) {
        sum += arr[i];
      } else {
        sum += arr[i] - arr[i] % 10 + 10;
      }
    }

    console.log(sum - 10 + mod);

  } 


}


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