#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5), b(5), c(5);
  int count = 0, plus = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a.at(i);
    b.at(i) = a.at(i) % 10;
    c.at(i) = a.at(i) / 10;
  }
  sort(b.begin(), b.end());
  for (int i = 0; i < 5; i++) {
    if (b.at(i) != 0) {
      count++;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (b.at(i) != 0) {
      plus = b.at(i);
      break;
    }
  }
  for (int i = 0; i < 5; i++) {
    count += c.at(i);
  }
  cout << (count - 1) * 10 + plus;
}
