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