#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, b = B % 10, c = C % 10, d = D % 10, e = E % 10;
  vector<int> g = {a, b, c, d, e};
  sort(g.begin(), g.end());
  int goukei = A + B + C + D + E - a - b - c - d - e + 50;
  int goukei2;
  for (int i = 0; i < g.size(); i++) {
    if (g.at(i) == 0) {
      goukei -= 10;
    } else {
      goukei2 = goukei + g.at(i) - 10;
      break;
    }
  }
  cout << goukei2 << endl;
}
