#include <bits/stdc++.h>
int main() {
  int cm[5];
  int end;
  int k = 0, sum = 0;
  for (int i = 0; i < 5; i++) scanf("%d", &cm[i]);
  end = cm[1];
  for (int i = 1; i < 5; i++) {
    if ((cm[i] + 9) % 10 < (end + 9) % 10) {
      end = cm[i];
      k = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (i == k)
      sum += cm[i];
    else
      sum += cm[i] + 9 - (cm[i] + 9) % 10;
  }
  printf("%d", sum);
  return 0;
}
