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