#include <bits/stdc++.h>
typedef struct _tmp_t {
  int val;
} tmp_t;
int compare(const void *a, const void *b) {
  tmp_t *x;
  tmp_t *y;
  int X, Y;
  x = (tmp_t *)a;
  y = (tmp_t *)b;
  X = x->val % 10;
  if (X == 0) {
    X = 10;
  }
  Y = y->val % 10;
  if (Y == 0) {
    Y = 10;
  }
  if (X < Y) return 1;
  if (X > Y) return -1;
  return 0;
}
void qsort_tmp(tmp_t *array, int size) {
  qsort(array, size, sizeof(tmp_t), compare);
}
tmp_t order[5];
int main() {
  int cnt;
  int i;
  int total = 0;
  for (i = 0; i < 5; i++) {
    cnt = scanf("%d", &order[i].val);
  }
  qsort_tmp(order, 5);
  for (i = 0; i < 5; i++) {
    total += order[i].val;
    if (i < (5 - 1)) {
      total += (10 - (order[i].val % 10));
    }
  }
  printf("%d", total);
  return 0;
}
