#include <bits/stdc++.h>
int main() {
  int ary1[5], ary2[5], ten = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &ary1[i]);
    ary2[i] = ary1[i] % 10;
    if (ary2[i] == 0) ten++;
  }
  ten++;
  int net = 5 - ten;
  int mininum = 9;
  for (int i = 0; i < 5; i++) {
    if (ary2[i] <= mininum && ary2[i] != 0) mininum = ary2[i];
  }
  int gt = 0;
  for (int i = 0; i < 5; i++) {
    gt += ary1[i] - ary2[i];
  }
  gt += net * 10;
  gt += mininum;
  printf("%d\n", gt);
  return 0;
}
