#include <bits/stdc++.h>
using namespace std;
template <typename T>
void input(T *data, int n) {
  for (int i = 0; i < n; i++) {
    cin >> data[i];
  }
}
template <typename T>
void sort(vector<T> &ary) {
  sort(ary.begin(), ary.end());
}
template <typename T>
void rsort(vector<T> &ary) {
  sort(ary.rbegin(), ary.rend());
}
void rstring(string &str) {
  string temp = str;
  for (int i = 0; i < (int)str.size(); i++) {
    str[i] = temp[(str.size() - 1) - i];
  }
}
struct Vec {
  int x, y;
  Vec() : x(0), y(0) {}
};
int main() {
  int x[5];
  input(x, 5);
  int time = 0;
  int maxloss = 0;
  for (int i = 0; i < 5; i++) {
    time += (x[i] % 10 == 0) ? time : ((x[i] / 10 + 1) * 10);
    if (x[i] % 10 && (x[i] / 10 + 1) * 10 - x[i] > maxloss) {
      maxloss = (x[i] / 10 + 1) * 10 - x[i];
    }
  }
  time -= maxloss;
  cout << time << endl;
  return 0;
}
