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