#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (ll i = (0), __last_i = (v.size()); i < __last_i; i++) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
  for (ll i = (0), __last_i = (v.size()); i < __last_i; i++) {
    if (i) os << endl;
    os << v[i];
  }
  return os;
}
int main() {
  ll A, B, C, D, E;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;
  cin >> E;
  ll A_10, B_10, C_10, D_10, E_10;
  A_10 = (A / 10) * 10;
  B_10 = (B / 10) * 10;
  C_10 = (C / 10) * 10;
  D_10 = (D / 10) * 10;
  E_10 = (E / 10) * 10;
  ll M;
  M = min(min(min(A % 10, B % 10), min(C % 10, D % 10)), E % 10);
  ll ans = 0;
  if (M == A % 10) {
    ans = A + B_10 + C_10 + D_10 + E_10;
  } else if (M == B % 10) {
    ans = A_10 + B + C_10 + D_10 + E_10;
  } else if (M == C % 10) {
    ans = A_10 + B_10 + C + D_10 + E_10;
  } else if (M == D % 10) {
    ans = A_10 + B_10 + C_10 + D + E_10;
  } else {
    ans = A_10 + B_10 + C_10 + D_10 + E;
  }
  cout << ans + 40 << endl;
}
