#include <bits/stdc++.h>
int main() {
  int a[5];
  int one = 10;
  int time = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", a + i);
    int buf = a[i] % 10;
    time = time + a[i] + buf - 10;
    if (buf != 0)
      if (buf < one) one = buf;
  }
  time = time + one - 10;
  printf("%d\n", time);
  return 0;
}
