a=[]
for i in range(5):
  a.append(int(input()))
bs=[]
cs=[]
for i in range(5):
    if a[i]%10!=0:
        b=int(a[i]/10)*10+10
        c=str(a[i])[-1]
        cs.append(int(c))
    else:
        b=a[i]
    bs.append(b)
print(sum(bs)+min(cs)-10)