#include <bits/stdc++.h>
int cmp(const void *p, const void *q) { return *(int *)p - *(int *)q; }
int adjust_time(int input_time) {
  if (input_time % 10 == 0) {
    return input_time;
  }
  input_time += (10 - (input_time % 10));
  return input_time;
}
int get_last_dish(int tmp_array[10]) {
  int max_value = 0;
  int max_index = 0;
  for (int i = 0; i < 5; i++) {
    if (max_value < tmp_array[i]) {
      if (tmp_array[i] % 10 == 0) {
        continue;
      }
      max_value = 10 - (tmp_array[i] % 10);
      max_index = i;
    }
  }
  return max_index;
}
int main() {
  int a, b, c, d, e = 0;
  int el_time = 0;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  int tmp_array[5] = {a, b, c, d, e};
  int last_index = get_last_dish(tmp_array);
  for (int i = 0; i < 5; i++) {
    if (!(i == last_index)) {
      el_time += adjust_time(tmp_array[i]);
    }
  }
  el_time += tmp_array[last_index];
  printf("%d", el_time);
  return 0;
}
