array=[int(input()) for i in range(5)]
n=10
sum=0

for i in range(5): 
    if array[i]%10<n and n!=0: n=array[i]
for i in range(5): sum += int(array[i]/10)+1
if n!=10: print(sum*10-(10-n%10))
else: print(sum*10)