#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> x(5);
  for (int i = 0; i < 5; ++i) {
    cin >> x[i];
  }
  int min_ = 9999999;
  for (int i = 0; i < 5; ++i) {
    int count = 0;
    for (int j = 0; j < 5; ++j) {
      count += x[j] + (10 - x[j] % 10);
    }
    min_ = min(min_, count);
  }
  cout << min_ << endl;
}
