#include <bits/stdc++.h>
using namespace std;
int A, B, C, D, E;
int ans;
int main() {
  cin >> A >> B >> C >> D >> E;
  int ar[5];
  ar[0] = A % 10;
  ar[1] = B % 10;
  ar[2] = C % 10;
  ar[3] = D % 10;
  ar[4] = E % 10;
  ans += A + B + C + D + E;
  sort(ar, ar + 5);
  ans += 40 - ar[1] - ar[2] - ar[3] - ar[4];
  cout << ans << endl;
  return 0;
}
