#include <bits/stdc++.h>
using namespace std;
int main() {
  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 (N % 10 == 0)
      nexttime[i] = time[i];
    else
      nexttime[i] = time[i] - (time[i] % 10) + 10;
  }
  int besttime = 99999999;
  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 << endl;
  return 0;
}
