#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;
}
using ll = long long;
const ll MOD = 1e9 + 7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;
int main() {
  vector<int> box(5);
  for (int i = (0); i < (int)(5); i++) cin >> box[i];
  int mini = INF;
  int sum = 0;
  for (int i = (0); i < (int)(5); i++) {
    sum += ceil(box[i] / 10.0) * 10;
    if (box[i] % 10 == 0) continue;
    mini = min(mini, box[i] % 10);
  }
  cout << sum - 10 + mini << endl;
}
