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