#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 changeto10(int x) { x = (x + 9) / 10 * 10; }
int main() {
  ll A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int M;
  M = min(min(min(A % 10, B % 10), min(C % 10, D % 10)), E % 10);
  int ans = changeto10(A) + changeto10(B) + changeto10(C) + changeto10(D) +
            changeto10(E);
  ;
  if (M == A % 10) {
    ans = ans - changeto10(A) + A;
  } else if (M == B % 10) {
    ans = ans - changeto10(B) + B;
  } else if (M == C % 10) {
    ans = ans - changeto10(C) + C;
  } else if (M == D % 10) {
    ans = ans - changeto10(D) + D;
  } else {
    ans = ans - changeto10(E) + E;
  }
  cout << ans << endl;
}
