#include <bits/stdc++.h>
int main(void) {
  int a, b, c, d, e, n = 0, s = 0, mati = 0;
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  int menu[5] = {a, b, c, d, e};
  for (int i = 0; i < 5; i++) {
    s += menu[i];
    if (!menu[i] % 10 == 0) {
      mati += 10 - menu[i] % 10;
      if (10 - menu[i] % 10 < 10 - menu[i + 1] % 10) {
        n = 10 - menu[i + 1] % 10;
      }
    }
  }
  printf("%d", s + mati - n);
  return 0;
}
