#include <bits/stdc++.h>
using namespace std;
class Menu {
 public:
  int time;
  Menu(int t) { time = t; }
  bool operator<(const Menu &another) const {
    return time % 10 < another.time % 10;
  };
};
int main() {
  vector<Menu> menuList;
  int tempT, flag = 0, sum = 0;
  for (int ite = 0; ite < 5; ite++) {
    cin >> tempT;
    menuList.push_back(Menu(tempT));
  }
  std::sort(menuList.begin(), menuList.end());
  for (int ite = 0; ite < 5; ite++) {
    if (menuList[ite].time % 10 == 0) {
      sum += menuList[ite].time;
    } else {
      if (flag == 0) {
        sum += menuList[ite].time;
        flag++;
        continue;
      }
      menuList[ite].time = menuList[ite].time + 10 - menuList[ite].time % 10;
      sum += menuList[ite].time;
    }
  }
  cout << sum << endl;
}
