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

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