#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e;
  scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
  int higher = 10;
  int nums[] = {a, b, c, d, e};
  int sum;
  for (int i = 0; i < 5; i++) {
    if (nums[i] % 10 != 0) {
      if (nums[i] % 10 < higher) higher = nums[i] % 10;
      sum += nums[i] + 10 - nums[i] % 10;
    } else {
      sum += nums[i];
    }
  }
  sum += -10 + higher % 10;
  printf("%d\n", sum);
  return 0;
}
