#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e, s[5], i, j, x = 0, y = 0, k = 0, z = 0, u = 0, aux;
  scanf("%i", &a);
  scanf("%i", &b);
  scanf("%i", &c);
  scanf("%i", &d);
  scanf("%i", &e);
  x = ((a / 10) + 1) * 10 - a;
  y = ((b / 10) + 1) * 10 - b;
  k = ((c / 10) + 1) * 10 - c;
  z = ((d / 10) + 1) * 10 - d;
  u = ((e / 10) + 1) * 10 - e;
  s[0] = a + b + c + d + e + y + k + z + u;
  s[1] = a + b + c + d + e + x + k + z + u;
  s[2] = a + b + c + d + e + x + y + z + u;
  s[3] = a + b + c + d + e + x + y + k + u;
  s[4] = a + b + c + d + e + x + y + k + z;
  for (i = 0; i < 5; i++) {
    for (j = i; j < 5; j++) {
      if (s[j] <= s[i]) {
        aux = s[i];
        s[i] = s[j];
        s[j] = aux;
      }
    }
  }
  printf("%i\n", s[0]);
}
