#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  int way[5];
  way[0] = a;
  way[1] = b;
  way[2] = c;
  way[3] = d;
  way[4] = e;
  int time, i;
  int min = 9, k;
  for (i = 0; i < 5; i++) {
    if ((way[i] % 10) <= min && way[i] % 10 != 0) {
      min = way[i];
      k = i;
    }
  }
  for (i = 0; i < 5; i++) {
    if (way[i] % 10 == 0 || i == k)
      time += way[i];
    else {
      way[i] = way[i] - (way[i] % 10) + 10;
      time += way[i];
    }
  }
  printf("%d\n", time);
  return 0;
}
