#include <bits/stdc++.h>
using namespace std;
void OrderTime() {
  int A[5] = {};
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    cin >> A[i];
    A[i] += 9;
  }
  int min_surplus = 10;
  for (int i = 0; i < 5; i++) {
    min_surplus = min(min_surplus, (A[i]) % 10);
  }
  for (int i = 0; i < 5; i++) {
    if (A[i] % 10 != min_surplus) {
      sum += A[i] / 10 * 10;
    } else {
      sum += A[i] - 9;
    }
  }
  cout << sum << endl;
}
int main() {
  OrderTime();
  return 0;
}
