#include <bits/stdc++.h>
int main(void) {
  int i, ans = 0, temp, min_rem = INT_MAX, rem;
  int dish[(5)];
  scanf("%d%d%d%d%d", &dish[0], &dish[1], &dish[2], &dish[3], &dish[4]);
  for (i = 0; i < (5); i++) {
    rem = dish[i] % 10;
    if (rem == 0) {
      ans += dish[i];
      continue;
    }
    if (rem < min_rem) {
      min_rem = rem;
    }
    temp = dish[i] / 10;
    ans += temp * 10 + 10;
  }
  ans -= (10 - min_rem);
  printf("%d\n", ans);
  return 0;
}
