#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return (a % 10) > (b % 10); }
int main() {
  vector<int> v;
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    int h;
    cin >> h;
    if (h % 10 == 0)
      ans += h;
    else
      v.push_back(h);
  }
  sort(v.begin(), v.end(), cmp);
  for (int i = 0; i < v.size() - 1; i++) ans += ((v[i] + 10) - (v[i] % 10));
  ans += v.back();
  cout << ans << "\n";
  return 0;
}
