#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = A % 10;
  int b = B % 10;
  int c = C % 10;
  int d = D % 10;
  int e = E % 10;
  vector<int> vec = {a, b, c, d, e};
  sort(vec.begin(), vec.end());
  cout << A + B + C + D + E -
              (40 - vec.at(1) - vec.at(2) - vec.at(3) - vec.at(4))
       << endl;
}
