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