#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> X = {a % 10, b % 10, c % 10, d % 10, e % 10};
  sort(X.begin(), X.end());
  int W = 0, k;
  for (k = 0; k < 5; k++) {
    if (X[k] != 0) {
      W = X[k];
      break;
    }
    if (k = 4) {
      break;
    }
  }
  vector<int> Y = {a, b, c, d, e};
  for (int i = 0; i < 5; i++) {
    Y[i] /= 10;
  }
  int Z = 0;
  for (int i = 0; i < 5; i++) {
    Z += Y[i] * 10;
  }
  cout << Z + W + (4 - k) * 10 << endl;
}
