#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> s(5);
  vector<int> p(5);
  for (int i = 0; i < 5; i++) {
    cin >> s[i];
    p[i] = s[i] % 10;
  }
  sort(p.begin(), p.end());
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += ((s[i] - p[i]) / 10 + 1) * 10;
  }
  int q = 0, j = 0;
  while (q == 0) {
    if (p[j] != 0) q = p[j];
    j++;
  }
  sum -= 10 - q;
  cout << sum << endl;
}
