#include <bits/stdc++.h>
int main() {
  int A, B, C, D, E;
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);
  scanf("%d", &D);
  scanf("%d", &E);
  int l[] = {A, B, C, D, E};
  int min = 10;
  int frag = 0;
  long sum = 0;
  for (int i = 0; i < 5; i++) {
    if (l[i] % 10 >= 1) {
      if (l[i] % 10 <= min) {
        min = l[i] % 10;
        frag = i;
      }
    } else {
      sum += l[i];
      l[i] = 0;
    }
    sum += l[frag];
    l[frag] = 0;
    for (int t = 0; t < 5; t++) {
      if (l[t] != 0) {
        sum += l[t] + (10 - l[t] % 10);
      }
    }
    printf("%ld\n", sum);
    return 0;
  }
}
