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