#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> x(5);
  int A,B,C,D,E;
  cin >> A >> B >> C >> D >> E;
  x[0] = A%10;
  x[1] = B%10;
  x[2] = C%10;
  x[3] = D%10;
  x[4] = E%10;
  sort (x.begin(), x.end());i
  int Y = 40 - x[1] - x[2] - x[3] - x[4];
  for (int i=1; i<5; i++) {
    if (x[i] == 0) Y -= 10;
  }
  cout << A+B+C+D+E+Y << endl;
    