#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> v(5);
  int loss = 9;
  int num = -1;
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    cin >> v[i];
    if (v[i] % 10 != 0 && v[i] % 10 < loss) loss = v[i] % 10, num = v[i];
  }
  if (num == -1) {
    for (int i = 0; i < 5; ++i) {
      ans += v[i];
    }
    cout << ans << endl;
    return 0;
  } else {
    for (int i = 0; i < 5; ++i) {
      if (v[i] == num) {
        ans += v[i];
        num = (int)1e9;
      } else {
        if (v[i] % 10 == 0)
          ans += v[i];
        else
          ans += ((v[i] / 10) + 1) * 10;
      }
    }
    cout << ans << endl;
    return 0;
  }
  return 0;
}
