#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> coo(5);
  for (int i = 0; i < 5; i++) {
    cin >> coo.at(i);
  }
  int time = 0;
  int amari_max = -1;
  for (int i = 0; i < 5; i++) {
    int wait = 0;
    if (coo.at(i) % 10 != 0) {
      amari_max = max(amari_max, 10 - coo.at(i) % 10);
    }
    time += (coo.at(i) + 9) / 10 * 10;
  }
  cout << time - amari_max << endl;
}
