#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  long long a[10], ans = 0, ans2 = ((long long)1e18);
  for (long long i = 0; i < 5; i++) {
    cin >> a[i];
    ans += ((a[i] + 9) / 10) * 10;
    cout << ans << "\n";
  }
  for (long long i = 0; i < 5; i++) {
    ans2 = min(ans2, ans - ((a[i] + 9) / 10) * 10 + a[i]);
  }
  cout << ans2 << "\n";
  return 0;
}
