a = int(input())
b= int(input())
c = int(input())
d = int(input())
e = int(input())
l = [] 
for i in [a,b,c,d,e]:
    if i % 10 != 0: 
        l.append(i//10*10+10-i)
print(sum([a,b,c,d,e])+sum(sorted(l):-1]))