#include <bits/stdc++.h>
using namespace std;
int a[5];
int k[5];
int kotae;
int main() {
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (int i = 0; (i) < (5); ++(i)) {
    k[i] = a[i] - (a[i]) / 10 * 10;
    kotae += (a[i] + 9) / 10 * 10;
  }
  sort(k, k + 5);
  kotae -= (10 - k[0]);
  cout << kotae << endl;
  return 0;
}
