#include <bits/stdc++.h>
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
int main() {
  vector<pair<int, int>> p(5);
  for (long long i = 0; i < (5); ++i) {
    cin >> p[i].second;
    p[i].first = p[i].second % 10;
    if (p[i].first == 0) p[i].first = 10;
    p[i].second += 10 - p[i].first;
  }
  sort((p).begin(), (p).end());
  reverse((p).begin(), (p).end());
  int ans = 0;
  for (long long i = 0; i < (4); ++i) ans += p[i].second;
  if (p[4].first != 10) {
    ans += p[4].second + p[4].first - 10;
  } else {
    ans += ans += p[4].second + p[4].first;
  }
  cout << (ans) << endl;
}
