#include <bits/stdc++.h>
int main() {
  int input[5], mod[5];
  int min_index = 0, sum = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &input[i]);
    mod[i] = input[i] % 10;
    if (mod[min_index] > mod[i]) {
      min_index = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (i != min_index) {
      sum += input[i] / 10 * 10 + 10;
    } else {
      sum += input[i];
    }
  }
  printf("%d\n", sum);
  return 0;
}
