#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  vector<int> vec(5);
  for (int i = 0; i < 5; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  int MIN = INF;
  do {
    int sum = 0;
    for (int x : vec) {
      sum += x;
      sum = (sum + 10 - 1) / 10 * 10;
    }
    MIN = min(INF, sum);
  } while (next_permutation(vec.begin(), vec.end()));
  cout << MIN << endl;
}
