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