inputs = [0,0,0,0,0]
inputs[0] = int(input())

inputs[1] = int(input())

inputs[2] = int(input())

inputs[3] = int(input())

inputs[4] = int(input())


top = 10
top_i = -1

sum = 0

for i in range(5):
	if top > inputs[i] % 10:
		top = inputs[i] % 10
		top_i = i

for i in range(5):
	if i != top_i:
		#print(sum)
		sum = sum + int(inputs[i] / 10) * 10 + 10
sum = sum + inputs[top_i]

print(sum) 