#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int sum = 0;
  int max_lost = 0;
  for (int i = 0; i < 5; i++) {
    int order;
    cin >> order;
    sum += order;
    int lost = 10 - order%10;
    if (lsot == 10) lost = 0;
    
    sum += lost;
  	max_lost = max(max_lost, lost);
  }
  sum -= max_lost;
  cout << sum << endl;
  return 0;
}