#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int A, B, C, D, E, k;
  cin >> A >> B >> C >> D >> E >> k;
  int tmpA, tmpB, tmpC, tmpD, tmpE;
  tmpA = A % 10;
  tmpB = B % 10;
  tmpC = B % 10;
  tmpD = B % 10;
  tmpE = B % 10;
  int tmpmin = min(min(min(min(tmpA, tmpB), tmpC), tmpD), tmpE);
  cout << ((A + 9) / 10 * 10) + ((B + 9) / 10 * 10) + ((C + 9) / 10 * 10) +
              ((D + 9) / 10 * 10) + ((E + 9) / 10 * 10) + tmpmin - 10
       << "\n";
  return 0;
}
