#include <bits/stdc++.h>
int main(void) {
  int A, B, C, D, E, tmp, i, k, ans = 0, z[5], p;
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);
  scanf("%d", &D);
  scanf("%d", &E);
  ans = A + B + C + D + E;
  z[0] = A % 10;
  z[1] = B % 10;
  z[2] = C % 10;
  z[3] = D % 10;
  z[4] = E % 10;
  for (i = 4; i >= 1; i--) {
    for (k = 1; k <= i; k++) {
      if (z[k] > z[k - 1]) {
      } else {
        tmp = z[k];
        z[k] = z[k - 1];
        z[k - 1] = tmp;
      }
    }
  }
  for (p = 4; p >= 1; p--) {
    if (z[p] == 0) {
      ans = ans - 10 + z[p + 1];
      break;
    } else {
      ans = ans + 10 - z[p];
    }
  }
  printf("%d", ans);
  return 0;
}
