#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp;
  double rest;
  double out = 0;
  int min_rest = 10;
  bool flag = false;
  vector<int> min_index;
  vector<int> order_time;
  cin >> tmp;
  order_time.push_back(tmp);
  cin >> tmp;
  order_time.push_back(tmp);
  cin >> tmp;
  order_time.push_back(tmp);
  cin >> tmp;
  order_time.push_back(tmp);
  cin >> tmp;
  order_time.push_back(tmp);
  for (int i = 0; i < order_time.size(); i++) {
    rest = order_time[i] % 10;
    if (rest == 0) rest = 9.9;
    if (min_rest == rest) {
      min_index.push_back(i);
    }
    if (min_rest > rest) {
      min_rest = rest;
      min_index.clear();
      min_index.push_back(i);
    }
  }
  for (int i = 0; i < order_time.size(); i++) {
    flag = false;
    for (int j = 0; j < min_index.size(); j++) {
      if (i == min_index[j]) {
        flag = true;
        break;
      }
    }
    if (flag)
      continue;
    else {
      if ((order_time[i] % 10))
        out += order_time[i] + (10 - (order_time[i] % 10));
      else
        out += order_time[i];
    }
  }
  if (min_index.size() == 1) {
    out += order_time[min_index[0]];
  } else {
    out += (order_time[min_index[0]] + (10 - (order_time[min_index[0]] % 10))) *
           (min_index.size() - 1);
    out += order_time[min_index[0]];
  }
  cout << out << endl;
  return 0;
}
