#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> s(5);
  s.at(0) = a % 10;
  s.at(1) = b % 10;
  s.at(2) = c % 10;
  s.at(3) = d % 10;
  s.at(4) = e % 10;
  sort(s.begin(), s.end());
  int plus = 0;
  while (plus == 0) {
    int i = 0;
    plus = s.at(i);
    i++;
  }
  a = ((a + 9) / 10) * 10;
  b = ((b + 9) / 10) * 10;
  c = ((c + 9) / 10) * 10;
  d = ((d + 9) / 10) * 10;
  e = ((e + 9) / 10) * 10;
  int ans = a + b + c + d + e - 10 + plus;
  cout << ans << endl;
}
