#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int ans = 0;
  int arest = 10 - a % 10;
  int brest = 10 - b % 10;
  int crest = 10 - c % 10;
  int drest = 10 - d % 10;
  int erest = 10 - e % 10;
  if (arest == 10)
    arest = 0;
  else if (brest == 10)
    brest = 0;
  else if (crest == 10)
    crest = 0;
  else if (drest == 10)
    drest = 0;
  else if (erest == 10)
    erest = 0;
  int extra = max(arest, max(brest, max(crest, max(drest, erest))));
  ans = a + b + c + d + e + arest + brest + crest + drest + erest - extra;
  cout << ans << endl;
}
