#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> zero, non_zero;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    int tmp;
    cin >> tmp;
    if ((tmp % 10) == 0)
      zero.push_back(tmp);
    else
      non_zero.push_back(tmp);
  }
  if (non_zero.size() > 0) {
    sort(non_zero.begin(), non_zero.end(),
         [](int a, int b) { return a % 10 < b % 10; });
    for (int i = non_zero.size() - 1; i > 0; i--)
      sum += non_zero[i] + (10 - (non_zero[i] % 10));
  }
  if (zero.size() > 0)
    for (int i = 0; i < zero.size(); i++) sum += zero[i];
  sum += non_zero[0];
  cout << sum << endl;
  return 0;
}
