#include <bits/stdc++.h>
int main() {
  int dishes[5];
  for (int i = 0; i < 5; i++) {
    scanf("%d", &dishes[i]);
  }
  int swap;
  for (int i = 0; i < 5; i++) {
    for (int j = i; j < 4; j++) {
      if (dishes[j] % 10 < dishes[j + 1] % 10) {
        swap = dishes[j + 1];
        dishes[j + 1] = dishes[j];
        dishes[j] = swap;
      }
    }
  }
  int i = 4, time = 0, end = 4;
  while (dishes[i] % 10 == 0) {
    time += dishes[i];
    end--;
    i--;
    if (i < 0) break;
  }
  int j = 0;
  while (j < end) {
    time += (dishes[j] / 10) * 10 + 10;
    j++;
  }
  if (end >= 0) time += dishes[end];
  printf("%d", time);
  return 0;
}
