#include <bits/stdc++.h>
int main(void) {
  int i, max, sum, time[4], loss[4];
  sum = 0;
  for (i = 0; i < 5; i++) {
    scanf("%^\nd", &time[i]);
  }
  max = 0;
  for (i = 0; i < 5; i++) {
    if ((time[i] % 10) != 0) {
      if (max < (10 - (time[i] % 10))) max = 10 - (time[i] % 10);
    }
  }
  for (i = 0; i < 5; i++) {
    sum = sum + (time[i] - (time[i] % 10));
    if (time[i] % 10 != 0) sum += 10;
  }
  sum -= max;
  printf("%d\n", sum);
  return 0;
}
