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