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

last = min(l,key = lambda x:x%10)
l.remove(last)

sum = 0

for i in l:
    if i%10==0:
        sum+=i
    else:
        sum+=i-1%10+10
        
print(sum+last)

