#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int at, bt, ct, dt, et;
  at = (a + 9) / 10 * 10;
  bt = (b + 9) / 10 * 10;
  ct = (c + 9) / 10 * 10;
  dt = (d + 9) / 10 * 10;
  et = (e + 9) / 10 * 10;
  int aa, bb, cc, dd, ee;
  aa = a % 10;
  bb = b % 10;
  cc = c % 10;
  dd = d % 10;
  ee = e % 10;
  int mi = min({aa, bb, cc, dd, ee});
  cout << at + bt + ct + dt + et - 10 + mi << endl;
  return 0;
}
