#include <bits/stdc++.h>
int main() {
  std::vector<std::pair<int, int>> DISH;
  int ans = 0;
  int d;
  for (int i = 0; i < 5; i++) {
    std::cin >> d;
    int w = (d % 10 == 0) ? 0 : d % 10;
    DISH.push_back(std::make_pair(w, d));
  }
  std::sort(std::begin(DISH), std::end(DISH));
  for (int i = 0; i < 5; i++) {
    ans += DISH[i].second;
    if (i != 4) {
      if (ans % 10 != 0) {
        ans += (ans % 10);
      }
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
