#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0, last = 9;
  vector<int> a(5);
  vector<int> b;
  for (int(i) = (0); (i) <= (4); ++(i)) cin >> a[i];
  for (int(i) = (0); (i) <= (4); ++(i)) {
    ans += ((a[i] + 9) / 10) * 10;
    if (a[i] % 10 != 0) b.push_back(a[i] % 10);
  }
  for (int(i) = (0); (i) <= (b.size() - 1); ++(i)) {
    last = min(last, b[i]);
  }
  ans = ans - 10 + last;
  cout << ans << endl;
}
