#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  int ans = 0;
  int m, tmp = 10;
  for (long long i = 0, i_len = (5); i < i_len; ++i) {
    cin >> a.at(i);
    if (tmp > a.at(i) % 10) {
      tmp = a.at(i) % 10;
      m = i;
    }
  }
  for (long long i = 0, i_len = (5); i < i_len; ++i) {
    if (a.at(i) % 10 != 0 && i != m) {
      a.at(i) = (int)(a.at(i) / 10 + 1) * 10;
    }
    ans += a.at(i);
  }
  cout << ans << "\n";
  return 0;
}
