#include <bits/stdc++.h>
int main(void) {
  int a[5], last, t;
  last = 9;
  t = 0;
  for (int i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 10 == 0)
      t += a[i];
    else {
      t += a[i] + (10 - a[i] % 10);
      if (a[i] % 10 < last % 10) last = a[i];
    }
  }
  printf("%d", t - (10 - last % 10));
}
