#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> in(6);
  for (int i = 0; i < 5; i++) {
    cin >> in[i];
  }
  vector<int> ama;
  for (int j = 0; j < 5; j++) {
    if (in[j] % 10 == 0) {
      continue;
    } else {
      ama.push_back(in[j] % 10);
    }
  }
  int shou;
  shou = 0;
  for (int k = 0; k < 5; k++) {
    shou += in[k] / 10;
  }
  sort(ama.begin(), ama.end());
  size_t size = ama.size();
  cout << shou * 10 + (size - 1) * 10 + ama[0] << endl;
}
