#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[5], B[5], C, i, las, Ans, Q;
  for (i = 0; i < 5; i++) cin >> A[i];
  Ans = 0;
  for (i = 0; i < 5; i++) {
    if (A[i] < 10) {
      B[i] = A[i];
    } else if (A[i] < 100) {
      C = A[i] / 10;
      B[i] = A[i] - (C * 10);
    } else {
      C = (A[i] - 100) / 10;
      B[i] = A[i] - (C * 10) - 100;
    }
    if (B[i] != 0) {
      Q = 10 - B[i];
      A[i] = A[i] + Q;
    }
  }
  for (i = 0, las = 150; i < 5; i++) {
    if (las > B[i] && B[i] != 0) las = B[i];
  }
  for (i = 0; i < 5; i++) Ans += A[i];
  Ans = Ans - (10 - las);
  cout << Ans;
  return 0;
}
