#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> dish(5);
  int amari = 9;
  for (int i = 0; i < 5; ++i) {
    cin >> dish[i];
    if (dish[i] % 10 == 0) {
    } else {
      amari = min(amari, dish[i] % 10);
      dish[i] += (10 - dish[i] % 10);
    }
  }
  int sum = 0;
  for (int i = 0; i < 5; ++i) {
    sum += dish[i];
  }
  cout << sum - 10 + amari << endl;
}
