#include <bits/stdc++.h>
int main() {
  int last = 9, i, total_time = 0;
  int temp[6];
  for (i = 0; i < 5; i++) {
    scanf("%d", &temp[i]);
    if ((temp[i] % 10) != 0 && (last % 10) > (temp[i] % 10)) {
      last = temp[i];
      temp[i] = 0;
    }
  }
  for (i = 0; i < 5; i++) {
    total_time = (temp[i] % 10 == 0)
                     ? total_time + temp[i]
                     : total_time + temp[i] + (10 - (temp[i] % 10));
  }
  total_time += last;
  printf("%d\n", total_time);
  return 0;
}
