#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int a, b, c, d, e, t = 0, k = INT_MAX;
  cin >> a >> b >> c >> d >> e;
  t += (a + 9) / 10 * 10;
  t += (b + 9) / 10 * 10;
  t += (c + 9) / 10 * 10;
  t += (d + 9) / 10 * 10;
  t += (e + 9) / 10 * 10;
  if (a % 10 != 0) {
    k = min(k, a % 10);
  }
  if (b % 10 != 0) {
    k = min(k, b % 10);
  }
  if (c % 10 != 0) {
    k = min(k, c % 10);
  }
  if (d % 10 != 0) {
    k = min(k, d % 10);
  }
  if (e % 10 != 0) {
    k = min(k, e % 10);
  }
  if (k != INT_MAX) {
    t += k - 10;
  }
  cout << t << endl;
  getchar();
  getchar();
  return 0;
}
