#include <bits/stdc++.h>
int main() {
  int time, times[5], i, isEnd = 0, isSwap, a, b, tmp;
  for (i = 0; i < 5; i++) {
    if (scanf("%d", &time) == EOF) {
      return -1;
    }
    times[i] = time;
  }
  while (!isEnd) {
    isSwap = 0;
    for (i = 0; i < 4; i++) {
      a = times[i] % 10;
      if (a == 0) a = 10;
      b = times[i + 1] % 10;
      if (b == 0) b = 10;
      if (a < b) {
        tmp = times[i];
        times[i] = times[i + 1];
        times[i + 1] = tmp;
        isSwap = 1;
      }
    }
    if (!isSwap) {
      isEnd = 1;
    }
  }
  time = 0;
  for (i = 0; i < 4; i++) {
    time += ((times[i] / 10) * 10 + 10);
  }
  time += times[i];
  printf("%d\n", time);
  return 0;
}
