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