#include <bits/stdc++.h>
int main(void) {
  int time[5];
  scanf("%d\n%d\n%d\n%d\n%d\n", &time[0], &time[1], &time[2], &time[3],
        &time[4]);
  int min_r = 1 << 29;
  int total_time = 0;
  for (int i = 0; i < 5; ++i) {
    int r = time[i] % 10;
    if (r == 0)
      total_time += time[i];
    else {
      total_time += 10 * (time[i] / 10 + 1);
      if (min_r > r) min_r = r;
    }
  }
  total_time -= 10 - min_r;
  printf("%d\n", total_time);
  return 0;
}
