#include <bits/stdc++.h>
using namespace std;
int abc[5];
int main() {
  for (int i = 0; i < (int)(5); i++) cin >> abc[i];
  int n = 5;
  vector<int> nexttime(n);
  for (int i = 0; i < (int)(n); i++) {
    nexttime[i] = (abc[i] + 9) / 10 * 10;
  }
  int besttime = 999999;
  for (int i = 0; i < (int)(n); i++) {
    int sumtime = 0;
    for (int j; j < n; j++) {
      if (i == j)
        sumtime += abc[i];
      else {
        sumtime += nexttime[i];
      }
    }
    besttime = min(besttime, sumtime);
  }
  cout << besttime << endl;
}
