#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 2000000000;
const int INF2 = 10000000;
const double Micro = 1e-5;
int UnUsedVariable() {
  if (INF || Micro || MOD || INF2) {
    ;
  }
  return 0;
}
inline int isEven(int x) { return x % 2 == 0; }
inline int isOdd(int x) { return x % 2 == 1; }
int printintN(int array[], const int num) {
  for (int i = 0; i < num; i++) {
    printf("%d ", array[i]);
  }
  printf("\n");
  ;
  return 0;
}
int experiment() {
  int ans = 0;
  int A[5];
  cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
  int MaxOfDigitOfOne = 10;
  for (int i = (0); i < (5); i++) {
    if (A[i] % 10 > 0) MaxOfDigitOfOne = min(MaxOfDigitOfOne, A[i] % 10);
  }
  if (MaxOfDigitOfOne == 10) MaxOfDigitOfOne = 0;
  for (int i = (0); i < (5); i++) {
    A[i] = (A[i] / 10) * 10 + (A[i] % 10 > 0) * 10;
  }
  ans = A[0] + A[1] + A[2] + A[3] + A[4] - 10 + MaxOfDigitOfOne;
  {
    cout << (ans) << endl;
    return 0;
  };
  return 0;
}
signed main() {
  assert(1);
  experiment();
  return 0;
}
