#include <bits/stdc++.h>
int main() {
  int i, j, k, m, s;
  m = 99;
  for (s = i = 0; i < 5; i++) {
    scanf("%d", &j);
    if (j % 10 > m || j % 10 == 0) {
      k = (j + 9) / 10;
      s += k * 10;
    } else {
      if (m != 99 && m > 0) s += 10;
      m = j % 10;
      k = j / 10;
      s += k * 10;
    }
  }
  printf("%d\n", s + m);
  return 0;
}
