#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 = &a;
  if (a % 10 < *higher % 10) higher = &a;
  if (b % 10 < *higher % 10) higher = &b;
  if (c % 10 < *higher % 10) higher = &c;
  if (d % 10 < *higher % 10) higher = &d;
  if (e % 10 < *higher % 10) higher = &e;
  int n = *higher;
  a += 10 - a % 10;
  b += 10 - b % 10;
  c += 10 - c % 10;
  d += 10 - d % 10;
  e += 10 - e % 10;
  *higher = n;
  printf("%d\n", a + b + c + d + e);
  return 0;
}
