'use strict';

function Main(input) {
  const A = input.split("\n")[0]
  const B = input.split("\n")[1]
  const C = input.split("\n")[2]
  const D = input.split("\n")[3]
  const E = input.split("\n")[4]

  const endA = A.substr(-1, 1)
  const endB = B.substr(-1, 1)
  const endC = C.substr(-1, 1)
  const endD = D.substr(-1, 1)
  const endE = E.substr(-1, 1)
  
  let endMin = 10
  if (endA < endMin && endA != 0) {
      endMin = endA
  }
  if (endB < endMin && endB != 0) {
      endMin = endB
  }
  if (endC < endMin && endC != 0) {
      endMin = endC
  }
  if (endD < endMin && endD != 0) {
      endMin = endD
  }
  if (endE < endMin && endE != 0) {
      endMin = endE
  }

  const roundA = Math.ceil(A / 10) * 10
  const roundB = Math.ceil(B / 10) * 10
  const roundC = Math.ceil(C / 10) * 10
  const roundD = Math.ceil(D / 10) * 10
  const roundE = Math.ceil(E / 10) * 10

  console.log(roundA + roundB + roundC + roundD + roundE - 10 + Number(endMin))
};

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