process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
  var a = Number(lines[0]);
  var b = Number(lines[1]);
  var c = Number(lines[2]);
  var d = Number(lines[3]);
  var e = Number(lines[4]);
  var ans = 0;
  var info = [];
 
  info.push(a);
  info.push(b);
  info.push(c);
  info.push(d);
  info.push(e);
 
  var amari = [];
  amari.push(a%10);
  amari.push(b%10);
  amari.push(c%10);
  amari.push(d%10);
  amari.push(e%10);
  var amari_t = amari.filter(function(value){
    return !(value == 0);
  });
 
  var min = Math.min(...amari_t);
 
  var index = amari.indexOf(min);
 
  for(i=0; i<5; i++){
    if(i==index){
      continue;
      console.log('A');
    }
    ans += info[i]
    if(ans%10 !== 0){
      while(ans%10 !== 0){
        ans++;
      }
    }
  }
 
  ans += info[index];
 
  console.log(ans);

});