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