#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp;
  int ans = 0;
  vector<int> rems;
  for (int i = 0; i < 5; i++) {
    cin >> tmp;
    if (tmp % 10 == 0)
      ans += tmp;
    else {
      ans += ((tmp / 10) + 1) * 10;
      rems.push_back(10 - tmp % 10);
    }
  }
  int maxi = *max_element(rems.begin(), rems.end());
  cout << ans - maxi << '\n';
  return 0;
}
