#include <bits/stdc++.h>
int cmp(const void *a, const void *b) {
  if (*(int *)a > *(int *)b) {
    return -1;
  } else if (*(int *)a < *(int *)b) {
    return 1;
  } else {
    return 0;
  }
}
int min(int a, int b) {
  if (a >= b) {
    return b;
  }
  return a;
}
int main(void) {
  int a[5];
  int i;
  int min = 99999;
  int hoji = 99999;
  int flag = 0;
  int sum = 0;
  scanf("%d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4]);
  for (i = 0; i < 5; i++) {
    if (a[i] % 10 != 0 && a[i] % 10 <= min) {
      min = a[0] % 10;
      hoji = i;
    }
  }
  if (hoji == 99999) {
    printf("%d\n", a[0] + a[1] + a[2] + a[3] + a[4]);
    return 0;
  }
  for (i = 0; i < 5; i++) {
    if (hoji == i && flag == 0) {
      continue;
      flag = 1;
    } else if (a[i] % 10 == 0) {
      sum = sum + a[i];
    } else {
      sum = sum + a[i] + (10 - a[i] % 10);
    }
  }
  sum = sum + a[hoji];
  printf("%d\n", sum);
}
