"use strict";
function Main(input) {
    let A = input.split("\n").map((v) => v - 0);
    let B = new Array(5);
    for (let n = 0; n < 5; n++) {
        let r = A[n] % 10;
        B[n] = [A[n], (r) ? 10 - r : 0];
    }
    B.sort((a, b) => a[1] - b[1]);
    let ans = 0;
    for (let n = 0; n < 5; n++) {
        ans += B[n][0] + ((n < 4) ? B[n][1] : 0);
    }
    console.log(ans);
}
if (typeof window === 'undefined') Main(require("fs").readFileSync("/dev/stdin", "utf8"));
