import numpy as np

nums = []
for i in range(5):
	nums.append(int(input()))

remainders = [0,0,0,0,0]
for i in range(5):
	remainders[i] = nums[i] % 10

sortedRemainders = np.argsort(remainders)

for i in range(5):
	sortedNums[i] = nums[sortedRemainders[i]]

elapsedTime = 0
for i in range(4):
	if sortedRemainders[i] == 0:
		elapsedTime += sortedNums[i]
	else:
		elapsedTime += sortedNums[i] + 10 - sortedRemainders

elapsedTime += sortedNums[4]

print(elapsedTime)