#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  vector<int> b;
  for (int i = 0; i < 5; i++) {
    int A;
    cin >> A;
    if (A % 10 != 0) b.push_back(A % 10);
    int temp = (A + 9) / 10;
    ans += temp * 10;
  }
  int sub = *min_element(b.begin(), b.end());
  ans -= (10 - sub);
  cout << ans << endl;
}
