#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > meal(5);
  for (int i = 0; i < (int)(5); i++) {
    cin >> meal[i].second;
    meal[i].first = (meal[i].second) % 10;
    if (meal[i].first == 0) meal[i].first = 10;
  }
  sort((meal).begin(), (meal).end());
  int count = 0;
  for (int i = 1; i < 5; i++) {
    count += meal[i].second;
  }
  count = (count / 10 + 1) * 10;
  count += meal[0].second;
  cout << count << endl;
  return 0;
}
