#include<cstdio>
#include<algorithm>
using namespace std;

int main() {
	int mi = 10, ans = 0;
	for(int i=0;i<5;i++) {
		int x; scanf("%d", &x);
		
		int rem = x%10;
		if(rem>0)
			mi = min(mi, rem);
		ans += (x-1)/10+1;
	}
	printf("%d\n", ans*10 - 10 + mi);
	
	return 0;
}