#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
template <typename T>
T gcd(T a, T b) {
  return (a == 0) ? b : gcd(b % a, a);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
bool p_comp_fs(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.first < p2.first;
};
bool p_comp_fg(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.first > p2.first;
};
bool p_comp_ss(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.second < p2.second;
};
bool p_comp_sg(const pair<long long, long long> p1,
               const pair<long long, long long> p2) {
  return p1.second > p2.second;
};
template <typename T>
vector<T> uniquen(vector<T> vec) {
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;
}
int main() {
  vector<long long> xs(5);
  long long ter = 10;
  for (long long i = 0; i < 5; i++) {
    long long x;
    cin >> x;
    if (x % 10 != 0) ter = min(ter, x % 10);
    xs[i] = ((x + 9) / 10) * 10;
  }
  if (ter == 10) ter = 0;
  long long ans = ter;
  for (long long i = 0; i < 5; i++) ans += xs[i];
  cout << ans - 10 << endstr;
  return 0;
}
