#include <bits/stdc++.h>
using namespace std;
int upper(int n) {
  if (n % 10 == 0)
    return n;
  else
    return n += (10 - n % 10);
}
int main(void) {
  vector<int> times(5);
  int i;
  int sum = 0;
  for (i = 0; i < 5; i++) cin >> times[i];
  int m = 0;
  for (i = 1; i < 5; i++)
    if ((times[i] % 10 < times[m] % 10) && (times[i] % 10 != 0)) m = i;
  for (i = 0; i < 5; i++)
    if (i != m) {
      sum += upper(times[i]);
      cout << "sum : " << sum << endl;
    }
  sum += times[m];
  cout << sum << endl;
  return 0;
}
