#include <bits/stdc++.h>
int min(int x, int y) { return x < y ? x : y; }
int main(void) {
  int time[5], ans = 0, M, i, m;
  scanf("%d", &time[0]);
  m = time[0] % 10;
  M = 0;
  for (i = 1; i < 5; i++) {
    scanf("%d", &time[i]);
    if (time[i] % 10 < m && time[i] % 10 != 0) {
      M = i;
      m = time[i];
    }
  }
  for (i = 0; i < 5; i++) {
    if (i != M) {
      ans += (time[i] / 10 + 1) * 10;
    } else {
      ans += time[i];
    }
  }
  printf("%d", ans);
  return 0;
}
