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

int main(){
	int ar[5], ans = 0, maxi = 0, cur;
	for(int i = 0; i < 5; i++){
		scanf("%d", &ar[i]);
		cur = ar[i]%10;
		ans += ar[i];
		if(cur > 0){
			ans += 10-cur;
			maxi = max(maxi, 10-cur);
		}
	}

	ans -= maxi;
	printf("%d\n", ans);
	
	return 0;
}