#include <bits/stdc++.h>
int main() {
  int dish[5];
  int minv = 9;
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &dish[i]);
    if (dish[i] % 10) {
      minv = ((minv) > (dish[i] % 10) ? (dish[i] % 10) : (minv));
      ans = ans + dish[i] + (10 - dish[i] % 10);
    } else {
      ans = ans + dish[i];
    }
  }
  printf("%d", ans - 10 + minv);
  return 0;
}
