#include <bits/stdc++.h>
using namespace std;
template <typename T = long long>
inline T IN() {
  T x;
  cin >> x;
  return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
  cin >> head;
  CIN(move(tail)...);
}
const int INF = 1e9;
const int MOD = 998244353;
const long long LINF = 1e18;
int x[5], k;
int main() {
  for (int i = 0; i < (5); ++i) cin >> x[i];
  int idx = 0;
  for (int i = 0; i < (5); ++i) {
    if (x[i] % 10) {
      if (x[i] % 10 < x[idx] % 10) {
        idx = i;
      }
    } else
      continue;
  }
  int ans = 0;
  for (int i = 0; i < (5); ++i) {
    if (i == idx)
      continue;
    else
      ans += (x[i] / 10 + 1) * 10;
  }
  ans += x[idx];
  cout << ans << "\n";
  return 0;
}
