#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
int main() {
  vector<int> v;
  for (int i = 0; i < 5; ++i) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  int last = 9;
  for (auto e : v) {
    if (e % 10 != 0 && e % 10 <= last % 10) last = e;
  }
  int ans = 0;
  for (auto e : v) {
    ans += e + (10 - (e % 10 != 0 ? e % 10 : 10));
  }
  ans -= 10 - (last % 10 != 0 ? last % 10 : 10);
  cout << ans << endl;
  return 0;
}
