#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  vector<int> d(5);
  for (int i = 0; i < (5); ++i) cin >> d[i];
  int mn = 700;
  int sum = 0;
  for (int i = 0; i < (5); ++i) {
    sum += ((d[i] + 9) / 10) * 10;
  }
  int saa = 0;
  int ookii;
  for (int i = 0; i < (5); ++i) {
    int sa = 0;
    sa = ((d[i] + 9) / 10) * 10 - d[i];
    if (saa < sa) {
      ookii = d[i];
      saa = sa;
    }
  }
  cout << sum - ((ookii + 9) / 10) * 10 + ookii << endl;
}
