#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp = 0, sum = 0, flag = 0;
  vector<int> dish(5);
  vector<int> amari(5);
  for (int i = 0; i < 5; i++) {
    cin >> dish.at(i);
  }
  for (int i = 0; i < 5; i++) {
    amari.at(i) = dish.at(i) % 10;
    if (amari.at(i) == 0) {
      sum = dish.at(i) + (10 - amari.at(i));
    } else if (amari.at(i) == 1 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 2 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 3 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 4 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 5 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 6 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 7 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 8 && flag == 0) {
      sum += dish.at(i);
    } else if (amari.at(i) == 9 && flag == 0) {
      sum += dish.at(i);
    } else if (flag == 0) {
      sum += dish.at(i) + (10 - amari.at(i));
    }
  }
  cout << sum << endl;
}
