#include <bits/stdc++.h>
int main(int argc, char **argv) {
  int a, b, c, d, e;
  int recipes[5];
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  recipes[0] = a;
  recipes[1] = b;
  recipes[2] = c;
  recipes[3] = d;
  recipes[4] = e;
  int min = 10;
  int mindex = 0;
  for (int i = 0; i < 5; i++) {
    if ((recipes[i] % 10) == 0) continue;
    if ((recipes[i] % 10) < min) {
      mindex = i;
      min = recipes[i] % 10;
    }
  }
  if (!(min == 10)) {
    recipes[mindex] -= min;
  }
  int time = 0;
  for (int i = 0; i < 5; i++) {
    time += (recipes[i] / 10) * 10;
    if ((recipes[i] % 10) == 0) continue;
    time += 10;
  }
  time += min;
  printf("%d", time);
  return 0;
}
