#include <bits/stdc++.h>
int main(void) {
  int a[5];
  for (int i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  int count = 0;
  int p = 9;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0)
      count++;
    else if (p > a[i] % 10) {
      p = a[i] % 10;
    }
  }
  p = p + 40 - count * 10;
  printf("%d\n", a[0] / 10 * 10 + a[1] / 10 * 10 + a[2] / 10 * 10 +
                     a[3] / 10 * 10 + a[4] / 10 * 10 + p);
  return 0;
}
