#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E, count;
  cin >> A >> B >> C >> D >> E;
  vector<int> F = {A % 10, B % 10, C % 10, D % 10, E % 10};
  sort(F.begin(), F.end());
  for (int i = 0; i < 5; i++) {
    if (F.at(i) == 0) {
      count++;
    }
  }
  cout << (A / 10 + B / 10 + C / 10 + D / 10 + E / 10 + 4 - count) * 10 +
              F.at(count);
}
