#include <bits/stdc++.h>
template <typename T>
std::string to_string(const T& n) {
  std::ostringstream stm;
  stm << n;
  return stm.str();
}
using namespace std;
const long long INF = 9000000000000000;
int main() {
  int a[5];
  int ans = 0, x = 10;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    x = min(x, a[i] % 10);
    if (a[i] % 10 != 0) {
      a[i] /= 10;
      a[i] = (a[i] + 1) * 10;
    }
    ans += a[i];
  }
  if (x != 0)
    cout << ans - (10 - x) << endl;
  else
    cout << ans << endl;
}
