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