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