#include <bits/stdc++.h>
using namespace std;
void printVec(std::vector<int>& vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
int main() {
  vector<int> h(5);
  vector<int> amari(5);
  vector<pair<int, int>> sub(5);
  for (int i = 0; i < 5; i++) {
    cin >> h[i];
    amari[i] = h[i] % 10;
    sub[i].first = amari[i];
    sub[i].second = h[i];
  }
  sort(sub.begin(), sub.end());
  int sum = 0;
  for (int i = 1; i < 5; i++) {
    sum += ((sub[i].second / 10) + 1) * 10;
  }
  sum += sub[0].second;
  cout << sum << endl;
  return 0;
}
