#include <bits/stdc++.h>
int a[5], b[5];
int main() {
  int i, j, r, t, t1, t2, m, min;
  for (i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  t = 0;
  j = 0;
  t1 = 0;
  for (i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      t = t + a[i];
    } else {
      r = a[i] % 10;
      t1 = t1 + (a[i] + (10 - r));
      b[j] = a[i];
      j++;
    }
  }
  min = b[0] % 10;
  for (i = 0; i < j; i++) {
    t2 = b[i] % 10;
    if (t2 < min) {
      min = t2;
    }
  }
  printf("%d\n", (t + t1) - min);
  return 0;
}
