def ceil(v):
	if v % 10 == 0:
		return v
	else:
		return (v // 10+1) *10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

times = [A,B,C,D,E]

minMod = 9
last = -1
for time in times:
	if minMod > (time+9) % 10:
		minMod = (time+9) % 10
		last = time
		
times.remove(last)

for i,time in enumerate(times):
	times[i] = ceil(time)
	
times.append(last)

print(sum(times))