#include <bits/stdc++.h>
int main(void) {
  int i, a[5];
  int time = 0;
  for (i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      time = time + a[i];
    } else {
      int hosuu = 10 - a[i] % 10;
      time = time + a[i] + hosuu;
    }
  }
  printf("%d", time);
  return 0;
}
