#include <bits/stdc++.h>
using namespace std;
inline void ci(void) { return; }
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest) {
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void) {
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest) {
  cout << first << " ";
  co(rest...);
  return;
}
int main() {
  int a = 10, b = 0;
  vector<int> A(5);
  for (int i = (int)(0); i < (int)(5); i++) {
    ci(A.at(i));
  }
  for (int i = (int)(0); i < (int)(5); i++) {
    if (A.at(i) % 10 != 0 && A.at(i) % 10 < a) {
      a = A.at(i) % 10;
      b = A.at(i);
    }
    if (A.at(i) % 10 != 0) {
      A.at(i) = (A.at(i) / 10 + 1) * 10;
    }
  }
  int ans = 0;
  for (int i = (int)(0); i < (int)(5); i++) {
    ans += A.at(i);
  }
  ans -= (b / 10 + 1) * 10;
  ans += b;
  co(ans);
}
