#include <bits/stdc++.h>
int main() {
  int ary[5], count = 0, bry[5];
  for (int i = 0; i < 5; i++) scanf("%d", &ary[i]);
  for (int i = 0; i < 5; i++) {
    count += ary[i] / 10;
    bry[i] = ary[i] % 10;
    if (ary[i] % 10 == 0) bry[i] = 9;
    if ((ary[i] % 10) != 0) count++;
  }
  int small;
  small = bry[0];
  for (int i = 0; i < 5; i++) {
    if (small > bry[i]) small = bry[i];
  }
  printf("%d", count * 10 - ((10 - small) % 10));
}
