#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
int main() {
  vector<int> a(5);
  int ans = 0;
  for (int i = 0; i < (int)(5); i++) {
    cin >> a.at(i);
    ans += ((a.at(i) / 10) + 1) * 10;
    a.at(i) = a.at(i) % 10;
  }
  sort(a.begin(), a.end());
  ans = ans - 10 + a.at(0);
  cout << ans;
}
