#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int minF = 9;
  vector<int> A(5);
  for (int i = 0; i < (5); ++i) {
    cin >> A[i];
    if (minF > (A[i] - 1) % 10) minF = A[i] % 10;
  }
  for (int i = 0; i < (5); ++i) ans += ((A[i] - 1) / 10 + 1) * 10;
  ans -= (10 - minF);
  cout << ans << endl;
  return 0;
}
