// 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/10 + bool(a%10)) * 10 - a;
		if(max_dif<dif) max_dif = dif;
		time += a + dif;
	};
	cout<< time - max_dif <<endl;
}