#include <bits/stdc++.h>
int main(void) {
  int a[5], b[5], tmp;
  int sum = 0, min = 100, last;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i] % 10;
  }
  for (int i = 0; i < 5; i++) {
    if (min > b[i] && b[i] > 0) {
      min = b[i];
      last = a[i];
    }
  }
  for (int i = 0; i < 5; i++) {
    if (b[i] != min) {
      if (b[i] == 0) {
        sum += a[i];
      } else {
        sum += a[i] + (10 - b[i]);
      }
    }
  }
  sum += last;
  printf("%d\n", sum);
}
