#include <bits/stdc++.h>
int min(int a, int b) {
  if (a <= b)
    return a;
  else
    return b;
}
void swap(int *p_from, int *p_to) {
  int tmp;
  tmp = *p_from;
  *p_from = *p_to;
  *p_to = tmp;
}
int main(void) {
  int a[5];
  int i;
  int min, c;
  c = 0;
  for (i = 0; i < 5; i++) scanf("%d", &a[i]);
  min = a[i];
  for (i = 0; i < 5; i++) {
    if (a[i] % 10 < min && a[i] % 10 != 0) min = a[i];
  }
  for (i = 0; i < 5; i++) {
    if (a[i] % 10 != 0 && a[i] != min)
      c += (a[i] / 10) * 10 + 10;
    else
      c += a[i];
  }
  printf("%d\n", c);
  return 0;
}
