#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> time(5);
  for (int i = 0; i < (5); ++i) cin >> time[i];
  vector<int> si = time;
  for (int i = 0; i < (5); ++i) {
    si[i] %= 10;
  }
  for (int i = 0; i < (5); ++i) {
    time[i] += (10 - si[i]);
  }
  sort(si.begin(), si.end());
  cout << si[0] + time[0] + time[1] + time[2] + time[3] + time[4] - 10 << endl;
  return 0;
}
