#125 b
def age(x):
    if x%10==0:
        return x
    else:
        return x+10-x%10

r=[]
amari=[]
amari_new=[]
amari_min=10
ans=0
for i in range(5):
    d=int(input())
    amari.append(d%10)
    r.append(age(d))

for x in range(5):
    if x!=0 and amari_min>x:
        amari_min=x
ans+=sum(r)


for x in amari:
    if x!=0:
        amari_new.append(x)

if amari_new:
    amari_min=min(amari)
    ans-=10-amari_min

print(ans)