#include <algorithm>
#include <iostream>

constexpr auto N = 5;

auto main() -> int {
  int ps[N];
  for (int i = 0; i < N; ++i) {
    std::cin >> ps[i];
  }
  std::sort(std::begin(ps), std::end(ps),
            [](auto a, auto b) { return (a % 10 != 0) && ((a % 10) < (b % 10)); });

  int ans = ps[0];
  for (auto i = 1; i < N; ++i) {
    if (ps[i] % 10 == 0) {
      ans += ps[i];
    } else {
      ans += ((ps[i] / 10) + 1) * 10;
    }
  }

  std::cout << ans << "\n";
}
