"use strict";
const Main = (input) =>{
    let xs = input.trim().split('\n').map(v=>parseInt(v,10));
    let A =[];
    let B =[]; 
    let ans = 0;
    for(let i=0; i<xs.length; i++){
    A.push(Math.ceil(xs[i]/10)*10);
    B.push(Math.ceil(xs[i]/10)*10-xs[i])
    ans+=A[i];
    }
    const compare = (a, b)=>{ 
    return b - a;      
    }
    B.sort(compare); 
    console.log(ans-B[0]);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));