#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  long long f = (min({(a + 9) % 10, (b + 9) % 10, (c + 9) % 10, (d + 9) % 10,
                      (e + 9) % 10}) +
                 1) %
                10;
  cout << (a - 1) / 10 * 10 + (b - 1) / 10 * 10 + (c - 1) / 10 * 10 +
              (d - 1) / 10 * 10 + (e - 1) / 10 * 10 + 40 + f
       << endl;
  return 0;
}
