#include <bits/stdc++.h>
int main() {
  int Time[5];
  int LastOne = 10;
  for (int i = 0; i < 5; i++) {
    if (scanf("%d", &Time[i]) == 1)
      ;
    if ((Time[i] % 10) != 0) {
      if ((Time[i] % 10) < LastOne) LastOne = (Time[i] % 10);
      Time[i] += (10 - (Time[i] % 10));
    }
  }
  printf("%d", (Time[0] + Time[1] + Time[2] + Time[3] + Time[4]) - LastOne);
  return 0;
}
