#include <bits/stdc++.h>
int roundup(int x) {
  int x1 = x + 5;
  int x2 = (int)((float)x1 / 10.0);
  return (int)x2 * 10;
}
int min1(int x[5]) {
  int min = 10;
  int min_index = -1;
  int i;
  for (i = 0; i < 5; i++) {
    if (x[i] % 10 < min && x[i] % 10 != 0) {
      min_index = i;
      min = x[i];
    }
  }
  return min_index;
}
int main(void) {
  int x[5];
  int i;
  for (int j = 0; j < 5; j++) {
    scanf("%d", &x[j]);
  }
  int min_index = min1(x);
  int y[5] = {0};
  int sum = 0;
  if (min_index != -1) {
    for (i = 0; i < 5; i++) {
      if (i != min_index) {
        sum += roundup(x[i]);
      }
    }
    sum += x[min_index];
  } else {
    for (i = 0; i < 5; i++) {
      sum += x[i];
    }
  }
  printf("%d", sum);
  return 0;
}
