#include <bits/stdc++.h>
int cmpfunc(const void* a, const void* b) {
  return (((int*)a)[1] - ((int*)b)[1]);
}
int main(void) {
  int i, ans = 0, h = 0, k = -1;
  int a[5][2];
  for (i = 0; i < 5; i++) {
    scanf("%d", &a[i][0]);
    a[i][1] = a[i][0] % 10;
  }
  qsort(a, 5, sizeof(int) * 2, cmpfunc);
  for (h = 0; h < 5; h++) {
    if (a[h][1] == 0) {
      ans = ans + a[h][0];
      k = h;
    }
  }
  if (k == -1) {
    for (h = 4; h >= k; h--) {
      ans = ans + a[h][0];
      if (h - k != 0) {
        ans = ((ans / 10) + 1) * 10;
      }
    }
  } else {
    for (h = 4; h > k; h--) {
      ans = ans + a[h][0];
      if (h - k != 1) ans = ((ans / 10) + 1) * 10;
    }
  }
  printf("%d", ans);
  return 0;
}
