#include <bits/stdc++.h>
int maxtime(int t) { return (t + 9) / 10 * 10; }
int main() {
  int a, b, c, d, e;
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  int total = maxtime(a) + maxtime(b) + maxtime(c) + maxtime(d) + maxtime(e);
  int arr[] = {a, b, c, d, e};
  int last = arr[0] % 10;
  for (int i = 1; i < 5; i++) {
    if (arr[i] % 10 != 0 && arr[i] % 10 < last) {
      last = arr[i] % 10;
    }
  }
  printf("%d", total - (10 - last));
  return 0;
}
