#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 5, sum = 0;
  int a[n], b[n];
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x % 10 == 0) {
      sum += x;
    } else {
      m[10 - x % 10] = x;
    }
  }
  {}
  int j = 0;
  auto it = m.begin();
  auto itt = it;
  itt++;
  while (itt != m.end()) {
    int temp = it->second;
    int q = ceil(temp / 10.0);
    q *= 10;
    sum += q;
    it++;
    itt++;
  }
  itt--;
  sum += itt->second;
  cout << sum << "\n";
  return 0;
}
