#include <bits/stdc++.h>
int main(void) {
  int cooking_time[5];
  int i;
  for (i = 0; i < 5; i++) {
    scanf("%d", &cooking_time[i]);
  }
  int min_time = 50;
  int min_of_first_digit = 10;
  for (i = 0; i < 5; i++) {
    if (min_of_first_digit > cooking_time[i] % 10) {
      min_of_first_digit = cooking_time[i] % 10;
    }
    min_time += cooking_time[i] - (cooking_time[i] % 10);
  }
  min_time -= 10 - min_of_first_digit;
  printf("%d\n", min_time);
  return 0;
}
