#include <bits/stdc++.h>
using namespace std;
int main() {
  int bestTime = INT_MAX;
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int n = 5;
  vector<int> time = {a, b, c, d, e};
  vector<int> nextTime(n);
  for (int i = 0; i < n; i++) {
    if (time[i] % 10 == 0) {
      nextTime[i] = time[i];
    } else {
      nextTime[i] = time[i] - time[i] % 10 + 10;
    }
  }
  for (int i = 0; i < n; i++) {
    int sumTime = 0;
    for (int j = 0; j < n; j++) {
      if (i == j)
        sumTime += time[j];
      else
        sumTime += nextTime[j];
    }
    bestTime = min(bestTime, sumTime);
  }
  cout << bestTime;
  return 0;
}
