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