#include <bits/stdc++.h>
using namespace std;

int main(){
  int minv = 10;
  int sum = 0;
  int a;
  for (int i=0; i<5; i++){
	cin >> a;
	sum += (a / 10 + 1) * 10;
	if (a % 10 == 0)
	  sum -= 10;
	else if (a % 10 < minv)
	  minv = a % 10;
  }
  cout << sum - 10 + minv << endl;
}
