#include <bits/stdc++.h>
int main() {
  int a[3], b[3], c[3], d[3], e[3], max;
  scanf("%d\n%d\n%d\n%d\n%d", &a[0], &b[0], &c[0], &d[0], &e[0]);
  a[1] = ((a[0] - 1) / 10 + 1) * 10;
  b[1] = ((b[0] - 1) / 10 + 1) * 10;
  c[1] = ((c[0] - 1) / 10 + 1) * 10;
  d[1] = ((d[0] - 1) / 10 + 1) * 10;
  e[1] = ((e[0] - 1) / 10 + 1) * 10;
  a[2] = (a[0] - 1) % 10 + 1;
  b[2] = (b[0] - 1) % 10 + 1;
  c[2] = (c[0] - 1) % 10 + 1;
  d[2] = (d[0] - 1) % 10 + 1;
  e[2] = (e[0] - 1) % 10 + 1;
  if (a[2] < b[2]) {
    max = a[2];
  } else {
    max = b[2];
  }
  if (max < c[2]) {
    max = c[2];
  }
  if (max < d[2]) {
    max = d[2];
  }
  if (max < e[2]) {
    max = e[2];
  }
  printf("%d", a[1] + b[1] + c[1] + d[1] + e[1] + max - 10);
  return 0;
}
