#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  long long res = 0;
  res += (a + 9) / 10 * 10;
  res += (b + 9) / 10 * 10;
  res += (c + 9) / 10 * 10;
  res += (d + 9) / 10 * 10;
  res += (e + 9) / 10 * 10;
  int in[5] = {a % 10, b % 10, c % 10, d % 10, e % 10};
  sort(in, in + 4);
  int mi = 0;
  for (int i = 0; i < (5); ++i) {
    if (in[i] != 0) {
      mi = in[i];
      break;
    }
  }
  cout << res - 10 + mi << endl;
}
