#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 (time[i] % 10 == 0)
      nextTime[i] = time[i];
    else
      nextTime[i] = time[i] - time[i] % 10 + 10;
  }
  int bestTime = 999999999;
  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[i];
      }
    }
    bestTime = min(bestTime, sumTime);
  }
  cout << bestTime << endl;
}
