#include <bits/stdc++.h>
int main(void) {
  int num[5];
  int tmp;
  int result = 0;
  for (int i = 0; i < 5; i++) scanf("%d", &num[i]);
  for (int i = 0; i < 5; i++) {
    for (int j = i + 1; j < 5; j++) {
      if (num[i] % 10 <= num[j] % 10) {
        tmp = num[i];
        num[i] = num[j];
        num[j] = tmp;
      }
    }
  }
  for (int i = 0; i < 4; i++) {
    num[i] = 10 + num[i] - num[i] % 10;
  }
  for (int i = 0; i < 5; i++) result += num[i];
  printf("%d\n", result);
  return 0;
}
