#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  vector<pair<int, int>> sa(5);
  for (int i = 0; i < (int)(5); i++) {
    sa[i].first = a[i] % 10;
    if (sa[i].first == 0) {
      sa[i].first = sa[i].first;
    } else {
      sa[i].first = 10 - sa[i].first;
    }
    sa[i].second = a[i] / 10;
  }
  sort(sa.begin(), sa.end());
  int sum = 0;
  for (int i = 0; i < (int)(4); i++) {
    if (sa[i].first == 0) {
      sum += sa[i].second * 10;
    } else {
      sum += sa[i].second * 10 + 10;
    }
  }
  sum += 10 - sa[4].first + sa[4].second * 10;
  cout << sum << endl;
  return 0;
}
