#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<int> v(5), d(5);
  long long pos = 0;
  for (long long i = 0; i < 5; ++i) {
    cin >> v[i];
    d[i] = 10 * (ceil(v[i] / 10));
  }
  for (long long i = 1; i < 5; ++i)
    if (d[i] - v[i] > d[i - 1] - v[i]) pos = i;
  long long ans = 0;
  for (long long i = 0; i < 5; ++i) {
    if (i == pos)
      ans += v[i];
    else
      ans += d[i];
  }
  cout << ans << endl;
  return 0;
}
