#include <bits/stdc++.h>
int kiriage(int n) {
  if (n % 10 == 0) {
    return n;
  } else {
    return n - (n % 10) + 10;
  }
}
int main() {
  int A[5];
  scanf("%d %d %d %d %d", &A[0], &A[1], &A[2], &A[3], &A[4]);
  int cnt = 9;
  for (int i = 0; i < 5; i++) {
    if ((A[i] % 10 < cnt) && (A[i] % 10 != 0)) {
      cnt = A[i] % 10;
    }
  }
  int total = 0;
  for (int i = 0; i < 5; i++) {
    total += kiriage(A[i]);
  }
  printf("%d", total + cnt - 10);
  return 0;
}
