#include <bits/stdc++.h>
int main(void) {
  int X[5];
  int min = 10;
  int sum = 0;
  int a = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &X[i]);
    if (X[i] % 10 != 0 && X[i] % 10 < min) {
      min = X[i] % 10;
      sum = X[i];
      a = i;
    }
  }
  X[a] = 0;
  for (int i = 0; i < 5; i++) {
    sum += ((X[i] + 9) / 10) * 10;
  }
  printf("%d", sum);
  return 0;
}
