#include <bits/stdc++.h>
int main() {
  int a, b, c, d, e;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  int time, way[5], ans[5], min = 10000;
  way[0] = a;
  way[1] = b;
  way[2] = c;
  way[3] = d;
  way[4] = e;
  for (int j = 0; j < 5; j++) {
    for (int i = 0; i < 5; i++) {
      if (way[i] == 0)
        time += way[i];
      else
        time += way[i] + 10 - (way[i] % 10);
    }
    ans[j] = time - 10 + (way[j] % 10);
  }
  for (int j = 0; j < 5; j++) {
    if (ans[j] < min) min = ans[j];
  }
  printf("%d\n", min);
  return 0;
}
