t=[]
max_time=999
for i in range(5):
    t.append(int(input()))
    if (t[i]%10)<max_time and (t[i]%10)!=0:
        max_time=(t[i]%10)
    if t[i]%10!=0:
        t[i]+=10-(t[i]%10)
print(sum(t)-(10-max_time))