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