c=list(int(input()) for i in range(5))
amari=0
ma=0
for i in range(5):
    if c[i]%10!=0:
        amari+=10-(c[i]%10)
        if c[i]%10>ma:
            ma=10-(c[i]%10)           
time=sum(c)+(int(amari-ma))
print(int(time))