#include <bits/stdc++.h>
using namespace std;
vector<long long int> v, v1;
vector<pair<long long int, long long int>> p;
int main() {
  long long int a[5], i, ans = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      ans = ans + a[i];
    } else
      v1.push_back(a[i]);
  }
  for (i = 0; i < v1.size(); i++) {
    p.push_back(make_pair(v1[i] % 10, v1[i]));
  }
  sort(p.begin(), p.end());
  for (i = p.size() - 1; i > 0; i--) {
    long long int d = p[i].second / 10;
    ans = ans + ((d + 1) * 10);
  }
  ans = ans + p[0].second;
  cout << ans;
  return 0;
}
