#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int>> A;
  int time = 0;
  for (int i = 0; i < 5; i++) {
    cin >> A[i].second;
    A[i].first = A[i].second % 5;
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < 5; i++) {
    time = (time + 9) / 10 * 10;
    time += A[i].second;
  }
  cout << time << endl;
}
