#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = INT_MAX;
const long long LLINF = 1LL << 60;
long long int gcd(long long int c, long long int d) {
  return d ? gcd(d, c % d) : c;
}
long long int lcm(long long int c, long long int d) {
  return c / gcd(c, d) * d;
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int s[5] = {}, m = 9, ans = 0, dis = 0, S = 0;
  for (int i = 0; i < 5; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < 5; i++) {
    S += s[i];
  }
  for (int i = 0; i < 5; i++) {
    if (s[i] % 10 != 0) {
      m = min(s[i] % 10, m);
      s[i] = (s[i] / 10 + 1) * 10;
    }
  }
  for (int i = 0; i < 5; i++) {
    ans += s[i];
  }
  if (s[0] % 10 != 0 && s[1] % 10 != 0 && s[2] % 10 != 0 && s[3] % 10 != 0 &&
      s[4] % 10 != 0) {
    cout << S << endl;
  } else {
    dis = ((m / 10 + 1) * 10) - m;
    cout << ans - dis << endl;
  }
  return 0;
}
