#include <bits/stdc++.h>
int main() {
  int a[5], i, x = 10, s = 0;
  for (i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 10 < x) x = i;
  }
  for (i = 0; i < 5; i++) {
    if (i != x)
      while (a[i] % 10 != 0) a[i]++;
    s += a[i];
  }
  printf("%d", s);
  return 0;
}
