#include <bits/stdc++.h>
using namespace std;
template <typename T>
T kiriage(T a, T b) {
  return (a + b - 1) / b;
}
void Main() {
  vector<int> vec(5);
  for (int i = 0; i < (5); ++i) cin >> vec[i];
  int mod_min = 10;
  int last_idx = -1;
  for (int i = 0; i < (5); ++i) {
    if (mod_min > vec[i] % 10) {
      mod_min = vec[i] % 10;
      last_idx = i;
    }
  }
  int res = 0;
  for (int i = 0; i < (5); ++i) {
    if (i == last_idx)
      res += vec[i];
    else
      res += kiriage(vec[i], 10) * 10;
  }
  cout << res << endl;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
