#include <bits/stdc++.h>
int main() {
  int time[6], i, sum, rest[6], tmp;
  tmp = 10;
  sum = 0;
  for (i = 1; i < 6; i++) {
    scanf("%d", &time[i]);
    rest[i] = time[i] % 10;
    if (rest[i] != 0) {
      time[i] += 10;
      if (tmp > rest[i]) tmp = rest[i];
    };
    sum += time[i] - rest[i];
  }
  if (tmp == 10) tmp = 0;
  sum += tmp - 10;
  printf("%d\n", sum);
  return 0;
}
