#include <bits/stdc++.h>
using namespace std;
using vl = vector<long long int>;
using vvl = vector<vector<long long int>>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;
template <typename T>
void print(T v) {
  for (size_t i = 0; i < v.size(); i++) {
    cout << i << ": " << v[i] << endl;
  }
}
template <typename T>
void print2(T v) {
  for (size_t i = 0; i < v.size(); i++) {
    cout << i << ": ";
    for (size_t j = 0; j < v[0].size(); j++) {
      cout << v[i][j] << " ";
    }
    cout << endl;
  }
}
template <typename T>
T slice(T v, long long int left, long long int right) {
  T ret(0);
  copy(v.begin() + left, v.begin() + right, back_inserter(ret));
  return ret;
}
bool func(vl s, vl t) { return s[1] < t[1]; }
int main() {
  vl vec(5);
  for (long long int i = 0; i < 5; i++) {
    cin >> vec[i];
  }
  long long int sum = 0;
  long long int max = 0;
  long long int t;
  for (long long int i = 0; i < 5; i++) {
    t = vec[i] % 10;
    if (t != 0) {
      sum += vec[i] + 10 - t;
    } else {
      sum += vec[i];
    }
    if (max < 10 - t) {
      max = 10 - t;
    }
  }
  cout << sum - max << endl;
  return 0;
}
