#include <bits/stdc++.h>
inline void rep(int n, std::function<void(int)> f) {
  for (int i = 0; i < n; i++) {
    f(i);
  }
};
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n, q, l, r;
  std::deque<std::pair<int, int> > v;
  int tmp, k;
  rep(5, [&](int i) {
    std::cin >> tmp;
    v.push_back(std::make_pair(0, tmp));
  });
  for (auto& e : v) {
    int sa = e.second % 10;
    if (sa != 0) {
      e.first = sa;
    } else {
      e.first = 10;
    }
  }
  std::sort(v.rbegin(), v.rend());
  int last = v.back().second;
  v.pop_back();
  int sum = 0;
  for (const auto& e : v) {
    int sa = e.second % 10;
    if (sa != 0) {
      std::cout << (e.second / 10 + 1) * 10 << '\n';
      sum += (e.second / 10 + 1) * 10;
    } else {
      std::cout << (e.second / 10) * 10 << '\n';
      sum += (e.second / 10) * 10;
    }
  }
  std::cout << sum + last << '\n';
  return 0;
}
