n = 5;
a = [int(input()) for i in range(n)];
last = 9;
time = 0;
flag = True;

for i in a:
	if last % 10  >= i % 10 >= 1:
		time += last  // 10 * 10 + 10;
		last = i;
		flag = False;

	elif i % 10 == 0:
		time += i;

 	else:
		time += i  // 10 * 10 + 10;

if flag:
	print(time + last - 9);

else:	
	print(time + last - 10);