#125 b

def kiriage(x):
    if x%10==0:
        return x
    else:
        return x+10-x%10

r=[]
amari_min=124
ans=0
for i in range(5):
    d=int(input())
    r.append(d)
    if amari_min>(d%10) and (d%10)!=0:
        amari_min=d

for x in r:
    if x==amari_min:
        ans+=x
    else:
        ans+=kiriage(x)
print(ans)
