#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (b < a) ? (a = b, 1) : 0;
}
const long double EPS = 1e-9L;
inline int sgn(const long double &r) { return (r > EPS) - (r < -EPS); }
inline long double sq(long double x) { return sqrt(max(x, 0.0L)); }
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
  vector<int> n(5);
  int lastN;
  int tmp = 9;
  bool used = false;
  for (int i = 0; i < 5; ++i) {
    cin >> n[i];
    if (n[i] % 10 != 0 && n[i] % 10 < tmp) {
      lastN = n[i];
      tmp = n[i] % 10;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    if (n[i] == lastN && !used)
      ans += lastN, used = true;
    else {
      if (n[i] % 10 == 0) {
        ans += n[i];
      } else {
        ans += ((n[i] / 10) + 1) * 10;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
