#include <bits/stdc++.h>
void swap(int *x, int *y) {
  int temp;
  temp = *x;
  *x = *y;
  *y = temp;
}
int partition(int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;
  do {
    do {
      i++;
    } while (array[i] < array[pivot]);
    do {
      j--;
    } while (array[pivot] < array[j]);
    if (i < j) {
      swap(&array[i], &array[j]);
    }
  } while (i < j);
  swap(&array[pivot], &array[j]);
  return j;
}
void quick_sort(int array[], int left, int right) {
  int pivot;
  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot - 1);
    quick_sort(array, pivot + 1, right);
  }
}
int main(void) {
  int i, n = 0, h = 9;
  int kore[1002];
  for (i = 0; i < 5; i++) {
    scanf("%d", &kore[i]);
  }
  quick_sort(kore, 0, 4);
  for (i = 0; i < 5; i++) {
    if (kore[i] % 10 == 0) {
      n = (((kore[i] / 10) + 1) * 10) + n - 10;
    } else {
      n = (((kore[i] / 10) + 1) * 10) + n;
    }
    if (h > kore[i] % 10 && kore[i] % 10 != 0) {
      h = kore[i] % 10;
    }
  }
  printf("%d", n + h - 10);
  return 0;
}
