cnt = 0
min = 9
li =[]

for i in range(5):
	a = int(input())
	li.append(a)
	if a % 10 == 0:
		cnt += a
	else:
		cnt += a + 10 - a % 10
		if a % 10 < min:
			min = a % 10

cnt = cnt + min - 10

print(cnt)
