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