#include <bits/stdc++.h>
using namespace std;
bool comp(const int &r, const int &l) {
  if (r == l) return true;
  return r % 10 > l % 10;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int food;
  vector<int> div_ten, div_not;
  for (int i = 0; i < 5; i++) {
    cin >> food;
    if (food % 10 == 0)
      div_ten.push_back(food);
    else
      div_not.push_back(food);
  }
  int ans = 0;
  for (int i = 0; i < div_ten.size(); i++) {
    ans += div_ten[i];
  }
  sort(div_not.begin(), div_not.end(), comp);
  for (int i = 0; i < div_not.size() - 1; i++) {
    ans += ((div_not[i] + 9) / 10) * 10;
  }
  ans += div_not[div_not.size() - 1];
  cout << ans << endl;
  return 0;
}
