#include <bits/stdc++.h>
int main(int argc, char* argv[]) {
  int cookingTime_i = 0;
  int cookingTime = 0;
  int numberOfMenue = 5;
  int shortestCookingTime = 124;
  int time = 0;
  for (cookingTime_i = 0; cookingTime_i < numberOfMenue; cookingTime_i++) {
    std::cin >> cookingTime;
    time = time + (((cookingTime + 9) / 10) * 10);
    if (((cookingTime - 1) % 10) < ((shortestCookingTime - 1) % 10)) {
      shortestCookingTime = cookingTime;
    }
  }
  time = time - (((shortestCookingTime + 9) / 10) * 10) + shortestCookingTime;
  std::cout << time << std::endl;
  return 0;
}
