#include <bits/stdc++.h>
int main(void) {
  int time[5], time_quo[5], time_TT[5];
  int i, sub, result = 0;
  for (i = 0; i < 5; i++) {
    scanf("%d", &time[i]);
    time_quo[i] = time[i] % 10;
    if (time[i] % 10 == 0) {
      time_TT[i] = (time[i] / 10) * 10;
    } else {
      time_TT[i] = ((time[i] / 10) + 1) * 10;
    }
  }
  for (i = 0; i < 5; i++) {
    result += time_TT[i];
  }
  sub = time_quo[0];
  for (i = 0; i < 5; i++) {
    if (sub > time_quo[i] && time_quo[i] != 0) {
      sub = time_quo[i];
    }
  }
  printf("%d\n", result - 10 + sub);
  return 0;
}
