#include <iostream>
#include <cstring>

using namespace std;

int GetDelta(int a) {
  int delta = 0;
  while(a % 10 != 0) {
    a += 1;
    delta += 1;
  }
  return delta;
}

int main() {
  vector<int> v(5, 0);
  int sum = 0;
  int sumDelta = 0;
  int maxDelta = -1;
  for(int i = 0; i < 5; ++i) {
    cin >> v[i];
    sum += v[i];
    sumDelta += GetDelta(v[i]);
    maxDelta = max(maxDelta, GetDelta(v[i]));
  }
  cout << (sum + sumDelta - maxDelta) << endl;
  return 0;
}
  
  