#include <bits/stdc++.h>
using namespace std;
int main() {
  int as[5];
  for (auto &a : as) {
    cin >> a;
  }
  sort(as, as + 5);
  reverse(as, as + 5);
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    ans += (as[i] + 9) / 10 * 10;
  }
  ans += as[4];
  cout << ans << endl;
  return 0;
}
