#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <class T>
void cout_vec(const vector<T> &vec1) {
  for (long long i = 0; i < long long(vec1.size()); i++) {
    cout << vec1[i] << ' ';
  }
  cout << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5);
  vector<int> b;
  int ans = 0;
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    ans += a[i];
    if (a[i] % 10 != 0) {
      b.push_back(10 - a[i] % 10);
      ans += 10 - a[i] % 10;
    }
  }
  cout << ans - *max_element(begin(b), end(b)) << endl;
}
