#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  vector<int> m(5);
  m = {a, b, c, d, e};
  int k = 10;
  for (int i = 0; i < 5; i++) k = min(k, m.at(i) % 10);
  int l = 0;
  for (int i = 0; i < 5; i++) l += (m.at(i) - 1) / 1;
  cout << l * 10 + k << endl;
}
