inputs=[int(input()) for i in range(5)]
summ=0
k=0
for i in inputs:
    if i%10==0:
        summ=summ+i
    else:
        s,m=divmod(i,10)
        summ=summ+(s+1)*10
        if 10-m>10-k:
          k=m
summ=summ-10+k
print(summ)