// B - Five Dishes
#include <bits/stdc++.h>
using namespace std;

int main(){
	int time = 0, max_dif = 0;
	for(int i=0; i<5; ++i){
		int a; cin>>a;
		int dif = ((a+9)/10) * 10 - a;
		max_dif = max(max_dif, dif);
		time += a + dif;
	}
	cout<< time - max_dif <<endl;
}