#include <bits/stdc++.h>
int to_ten(int n) {
  while (1) {
    if (n % 10) n++;
    if (n % 10 == 0) break;
  }
  return (n);
}
int diff(int nb) {
  int diff = 0;
  diff = to_ten(nb) - nb;
  return (diff);
}
int main() {
  int dish[6];
  int sum = 0;
  int i = 0;
  while (i < 5) scanf("%d", &dish[i++]);
  int max = diff(dish[4]);
  int last = 4;
  i = 0;
  while (i < 5) {
    if (diff(dish[i]) > max) {
      max = diff(dish[i]);
      last = i;
    }
    i++;
  }
  i = 0;
  while (i < 5) {
    sum += to_ten(dish[i]);
    i++;
  }
  sum -= diff(dish[last]);
  printf("%d\n", sum);
  return (0);
}
