#include <bits/stdc++.h>
int main() {
  int a[5], max, sum = 0, x = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
  }
  max = 0;
  while (x < 4) {
    if (a[x] % 10 != 0) {
      max = a[x];
      x = 5;
    }
    x++;
  }
  for (int i = 0; i < 4; i++) {
    if (a[i] % 10 == 0) {
    } else if (10 - max % 10 < 10 - a[i] % 10) {
      max = a[i];
    }
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] == max || a[i] % 10 == 0) {
    } else {
      a[i] += 10 - a[i] % 10;
    }
    sum += a[i];
  }
  printf("%d", sum);
}
