#include <bits/stdc++.h>
int main() {
  int dish[5];
  int i, j, m, min = 600;
  for (i = 0; i < 5; i++) {
    scanf("%d", &dish[i]);
  }
  for (i = 0; i < 5; i++) {
    m = 0;
    for (j = 0; j < 5; j++) {
      if (i == j)
        m += dish[j];
      else {
        if (dish[j] % 10 == 0)
          m += dish[j];
        else
          m += dish[j] + (10 - (dish[j] % 10));
      }
    }
    if (min > m) min = m;
  }
  printf("%d\n", min);
  return 0;
}
