#include <bits/stdc++.h>
int main() {
  char buf[1024];
  int *a = (int *)malloc(sizeof(int) * 5);
  for (int i = 0; i < ((int)5); i++) {
    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d", &a[i]);
  }
  int min = 1000000000;
  int min_n = 1000000000;
  for (int i = 0; i < ((int)5); i++) {
    int temp = a[i] % 10;
    if (temp != 0 && temp < min) {
      min = temp;
      min_n = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < ((int)5); i++) {
    if (i != min_n) {
      ans += ((a[i] / 10) + 1) * 10;
    } else {
      ans += a[i];
    }
  }
  printf("%d\n", ans);
  return 0;
}
