#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;
  int m = min(min(min(min(a, b), c), d), e);
  cout << A + B + C + D + E - a - b - c - d - e + 40 + m << endl;
}
