#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long prices[5];
  long long minimum = LONG_MAX;
  long long minimumIndex = 0;
  for (long long i = 0; i < 5; i++) {
    cin >> prices[i];
    long long temp = prices[i] % 10;
    if (temp != 0 && temp < minimum) {
      minimum = temp;
      minimumIndex = i;
    }
  }
  long long sum = 0;
  for (long long i = 0; i < 5; i++) {
    if (minimum == LONG_MAX || i != minimumIndex) {
      sum += 10 * ceil(prices[i] / 10.0);
    }
  }
  sum += prices[minimumIndex];
  cout << sum << endl;
  return 0;
}
