#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200;
int main() {
  vector<int> dishes(5);
  for (int i = 0; i < 5; ++i) {
    cin >> dishes[i];
  }
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    sum += (dishes[i] + 9) / 10 * 10;
  }
  int time = INT_MAX;
  for (int i = 0; i < 5; ++i) {
    int t = sum - (dishes[i] + 9) / 10 * 10 + dishes[i];
    time = min(time, t);
  }
  cout << time << endl;
  return 0;
}
