#include <bits/stdc++.h>
using namespace std;
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();
void abc123_b(vector<vector<string>> v) {
  int a = atoi(v[0][0].c_str());
  int b = atoi(v[1][0].c_str());
  int c = atoi(v[2][0].c_str());
  int d = atoi(v[3][0].c_str());
  int e = atoi(v[4][0].c_str());
  int mindata = INT_MAX;
  if (a % 10 != 0) {
    mindata = min(mindata, a % 10);
  }
  if (b % 10 != 0) {
    mindata = min(mindata, b % 10);
  }
  if (c % 10 != 0) {
    mindata = min(mindata, c % 10);
  }
  if (d % 10 != 0) {
    mindata = min(mindata, d % 10);
  }
  if (e % 10 != 0) {
    mindata = min(mindata, e % 10);
  }
  if (mindata == INT_MAX) {
    mindata = 0;
  } else {
    mindata = 10 - mindata;
  }
  a += a % 10 == 0 ? 0 : 10 - (a % 10);
  b += b % 10 == 0 ? 0 : 10 - (b % 10);
  c += c % 10 == 0 ? 0 : 10 - (c % 10);
  d += d % 10 == 0 ? 0 : 10 - (d % 10);
  e += e % 10 == 0 ? 0 : 10 - (e % 10);
  cout << a + b + c + d + e - mindata << endl;
}
int main() {
  vector<vector<string>> vec_arr_result;
  vec_arr_result = getinputdata();
  abc123_b(vec_arr_result);
  return 0;
}
vector<vector<double>> getinputdata3() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<double>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<double> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(atof(ret.c_str()));
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
vector<vector<int>> getinputdata2() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<int>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<int> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(atoi(ret.c_str()));
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
vector<vector<string>> getinputdata() {
  string str;
  string ret;
  stringstream ss;
  vector<string> v1;
  vector<vector<string>> vec_arr;
  while (getline(cin, str)) {
    v1.push_back(str);
  }
  for (string s : v1) {
    vector<string> array_data;
    ss << s;
    while (!ss.eof()) {
      ss >> ret;
      array_data.push_back(ret);
    }
    vec_arr.push_back(array_data);
    ss.str("");
    ss.clear(stringstream::goodbit);
  }
  return vec_arr;
}
