#include <bits/stdc++.h>
using namespace std;
using vec = vector<long long>;
using mat = vector<vec>;
using Pii = pair<long long, long long>;
using PiP = pair<long long, Pii>;
using PPi = pair<Pii, long long>;
int main() {
  long long A = 0;
  long long ans = 0;
  long long Amin = 1000000000000000000;
  for (long long i = (0); i < (5); i++) {
    cin >> A;
    if (A % 10 > 0) Amin = min(Amin, A % 10);
    A = (A + 9) / 10;
    A *= 10;
    ans += A;
  }
  ans -= (10 - Amin);
  cout << ans << endl;
  return 0;
}
