#include <bits/stdc++.h>
int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int sum = 0;
  int min = INT_MAX;
  for (int i = 0; i < 5; ++i) {
    int time;
    std::cin >> time;
    if (time % 10) min = std::min(min, time % 10);
    sum += std::ceil(time / 10.f) * 10;
  }
  std::cout << sum - 10 + min << std::endl;
}
