#include <bits/stdc++.h>
int main(void) {
  int A, B, C, a, b, c, d, e, k, i, j, cou, min, v[1000000];
  char S[100000];
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  if ((a == b) && (a == c) && (a == d) && (a == e)) {
    if (a % 10 != 0) {
      a = a / 10 + 1;
      a = a * 10;
    }
    if (b % 10 != 0) {
      b = b / 10 + 1;
      b = b * 10;
    }
    if (c % 10 != 0) {
      c = c / 10 + 1;
      c = c * 10;
    }
    if (d % 10 != 0) {
      d = d / 10 + 1;
      d = d * 10;
    }
    printf("%d", a + b + c + d + e);
  } else {
    min = a;
    if ((min % 10 > b % 10) && (b % 10 != 0)) {
      min = b;
    }
    if ((min % 10 > c % 10) && (c % 10 != 0)) {
      min = c;
    }
    if ((min % 10 > d % 10) && (d % 10 != 0)) {
      min = d;
    }
    if ((min % 10 > e % 10) && (e % 10 != 0)) {
      min = e;
    }
    if ((a % 10 != 0) && (a % 10 != min)) {
      a = a / 10 + 1;
      a = a * 10;
    }
    if ((b % 10 != 0) && (b % 10 != min)) {
      b = b / 10 + 1;
      b = b * 10;
    }
    if ((c % 10 != 0) && (c % 10 != min)) {
      c = c / 10 + 1;
      c = c * 10;
    }
    if ((d % 10 != 0) && (d % 10 != min)) {
      d = d / 10 + 1;
      d = d * 10;
    }
    if ((e % 10 != 0) && (e % 10 != min)) {
      e = e / 10 + 1;
      e = e * 10;
    }
    printf("%d", a + b + c + d + e);
  }
  return 0;
}
