#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  int a[5];
  vector<int> r;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) r.push_back(a[i] % 10);
  }
  int minimum = *min_element(r.begin(), r.end());
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 != 0)
      ans += (a[i] / 10) * 10 + 10;
    else
      ans += a[i];
  }
  ans -= (10 - minimum);
  cout << ans << endl;
  return 0;
}
