#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, ans = 0, min_t = 129;
  for (int i = 0; i < 5; i++) {
    cin >> t;
    if (t % 10) {
      if (t % 10 <= min_t % 10) min_t = t;
      ans += ceil((double)t / 10) * 10;
    } else
      ans += t;
  }
  ans -= ceil((double)min_t / 10) * 10;
  ans += min_t;
  cout << ans << endl;
  return 0;
}
